From 31259f92f44a36442e8f2e427040a6f2b5d27833 Mon Sep 17 00:00:00 2001 From: Alem Tuzlak Date: Tue, 11 Jul 2023 09:20:06 +0200 Subject: [PATCH 1/2] Fixed fetcher formEncType in @remix-run/react exports --- .changeset/chatty-pears-float.md | 5 +++++ contributors.yml | 1 + packages/remix-react/transition.ts | 10 +++++----- 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .changeset/chatty-pears-float.md diff --git a/.changeset/chatty-pears-float.md b/.changeset/chatty-pears-float.md new file mode 100644 index 00000000000..18f55cc97fd --- /dev/null +++ b/.changeset/chatty-pears-float.md @@ -0,0 +1,5 @@ +--- +"@remix-run/react": patch +--- + +Changed the type of formEncType on useFetcher and useFetchers to be FormEncType from react-router-dom instead of strings diff --git a/contributors.yml b/contributors.yml index 86aebae0e6b..854f09503ad 100644 --- a/contributors.yml +++ b/contributors.yml @@ -556,3 +556,4 @@ - tanerijun - toufiqnuur - ally1002 +- AlemTuzlak \ No newline at end of file diff --git a/packages/remix-react/transition.ts b/packages/remix-react/transition.ts index ff937257562..ae12b614c9d 100644 --- a/packages/remix-react/transition.ts +++ b/packages/remix-react/transition.ts @@ -1,4 +1,4 @@ -import type { Location } from "react-router-dom"; +import type { Location, FormEncType } from "react-router-dom"; export interface Submission { action: string; @@ -137,7 +137,7 @@ export type FetcherStates = { type: "actionSubmission"; formMethod: FetcherActionSubmission["method"]; formAction: string; - formEncType: string; + formEncType: FormEncType; submission: FetcherActionSubmission; data: TData | undefined; } & FetcherSubmissionDataTypes; @@ -146,7 +146,7 @@ export type FetcherStates = { type: "loaderSubmission"; formMethod: FetcherLoaderSubmission["method"]; formAction: string; - formEncType: string; + formEncType: FormEncType; submission: FetcherLoaderSubmission; data: TData | undefined; } & FetcherSubmissionDataTypes; @@ -155,7 +155,7 @@ export type FetcherStates = { type: "actionReload"; formMethod: FetcherActionSubmission["method"]; formAction: string; - formEncType: string; + formEncType: FormEncType; submission: FetcherActionSubmission; data: TData; } & FetcherSubmissionDataTypes; @@ -164,7 +164,7 @@ export type FetcherStates = { type: "actionRedirect"; formMethod: FetcherActionSubmission["method"]; formAction: string; - formEncType: string; + formEncType: FormEncType; submission: FetcherActionSubmission; data: undefined; } & FetcherSubmissionDataTypes; From b4590bda1711aa7b9ee3f1b429b6fa7b85828b51 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Tue, 11 Jul 2023 10:46:24 -0400 Subject: [PATCH 2/2] Update .changeset/chatty-pears-float.md --- .changeset/chatty-pears-float.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/chatty-pears-float.md b/.changeset/chatty-pears-float.md index 18f55cc97fd..a51f222e43a 100644 --- a/.changeset/chatty-pears-float.md +++ b/.changeset/chatty-pears-float.md @@ -2,4 +2,4 @@ "@remix-run/react": patch --- -Changed the type of formEncType on useFetcher and useFetchers to be FormEncType from react-router-dom instead of strings +Narrowed the type of `fetcher.formEncType` to use `FormEncType` from `react-router-dom` instead of `string`