You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected types to work with a interface/type with arrays, such as the following:
interfaceBlogPost{title: string;authors: {name: string}[];}asyncfunctiongetBlogPost(): Promise<BlogPost>{returnPromise.resolve({title: 'example blog',authors: [{name: 'brooks'}],// This seems to be the problem});}exportconstloader=defineLoader(async()=>{constblog=awaitgetBlogPost();return{ blog };});
If you update getBlogPost to infer it's return type, everything works. However, this is not ideal, since that might require changing a lot of types, plus some people don't want their functions to infer types, they'd rather declare the return type.
Additionally, the type error message is pretty dense. For useLoader, the message is just
Type instantiation is excessively deep and possibly infinite.(2589)
Actual Behavior
unstable_defineLoader accepts types with arrays
The text was updated successfully, but these errors were encountered:
Reproduction
https://stackblitz.com/edit/remix-run-remix-l5e3dj?file=app%2Froutes%2F_index.tsx
System Info
Used Package Manager
npm
Expected Behavior
Expected types to work with a interface/type with arrays, such as the following:
If you update
getBlogPost
to infer it's return type, everything works. However, this is not ideal, since that might require changing a lot of types, plus some people don't want their functions to infer types, they'd rather declare the return type.Additionally, the type error message is pretty dense. For
useLoader
, the message is justActual Behavior
unstable_defineLoader
accepts types with arraysThe text was updated successfully, but these errors were encountered: