remix icon indicating copy to clipboard operation
remix copied to clipboard

'Possibly Infinite' type when attempting to use new Single Fetch types

Open lsthornt opened this issue 8 months ago • 2 comments

Reproduction

I have been running across various flavors of this issue, but I think I've distilled it to the simplest reproduction here: Typescript Playground reproduction

Essentially, when attempting to use the new single fetch DataFunction types, you can trigger Type instantiation is excessively deep and possibly infinite. ts(2589). I've found it helpful/necessary to use these types to develop boilerplate-reducing wrappers around unstable_defineAction/unstable_defineLoader.

Falling back to the currently-exposed ActionFunction type resolves the issue, but risks developing against the incorrect types.

I recognize that this is a issue on functions explicitly labeled as unstable, but I figured it may be helpful to expose as these future APIs get hardened.

System Info

Typescript Playground

Used Package Manager

npm

Expected Behavior

One can develop against the new ActionFunction types added in 2.9.2 without typescript errors

Actual Behavior

Attempting to use the internal DataFunctionReturnValue triggers a Typescript error.

lsthornt avatar Jun 24 '24 19:06 lsthornt