diff --git a/.changeset/gorgeous-toys-flash.md b/.changeset/gorgeous-toys-flash.md new file mode 100644 index 00000000000..44e5e9abc8f --- /dev/null +++ b/.changeset/gorgeous-toys-flash.md @@ -0,0 +1,5 @@ +--- +"remix": patch +--- + +REMOVE: bump prerelease version diff --git a/packages/remix-server-runtime/single-fetch.ts b/packages/remix-server-runtime/single-fetch.ts index a40195a8253..222f74bb4e2 100644 --- a/packages/remix-server-runtime/single-fetch.ts +++ b/packages/remix-server-runtime/single-fetch.ts @@ -418,23 +418,24 @@ type Serialize = undefined -type Fn = (...args: any[]) => unknown; - // Backwards-compatible type for Remix v2 where json/defer still use the old types, // and only non-json/defer returns use the new types. This allows for incremental // migration of loaders to return naked objects. In the next major version, // json/defer will be removed so everything will use the new simplified typings. // prettier-ignore -export type SerializeFrom = - Parameters extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? - Awaited> extends TypedResponse ? Jsonify : - Awaited> extends TypedDeferredData ? U : - Awaited> +export type SerializeFrom = + T extends (...args: infer Args) => infer Return ? + Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? + Awaited extends TypedResponse ? Jsonify : + Awaited extends TypedDeferredData ? U : + Awaited + : + Awaited extends TypedResponse ? Jsonify : + Awaited extends TypedDeferredData ? Serialize : + Awaited extends DataWithResponseInit ? Serialize : + Serialize>> : - Awaited> extends TypedResponse ? Jsonify : - Awaited> extends TypedDeferredData ? Serialize : - Awaited> extends DataWithResponseInit ? Serialize : - Serialize>>; + T type ServerLoader = (args: LoaderFunctionArgs) => T; type ClientLoader = (args: ClientLoaderFunctionArgs) => T; @@ -604,4 +605,7 @@ type _tests = [ Expect>>>, { a: string, b: string }>>, Expect}>>>>, { a: string, b: Promise }>>, + + // non-function backcompat + Expect, {a: string, b: Date}>> ]