-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type instantiation is excessively deep and possibly infinite.ts(2589) when using readonly #9776
Comments
The only code necessary to replicate is this: export const loader = defineLoader(async () => {
type RecentChat = {};
const recentChats: readonly RecentChat[] = [];
return {
recentChats,
};
});
const Route = () => {
const data = useLoaderData<typeof loader>();
}; |
@brophdawg11 I am facing the same issue. This is a blocker for adopting |
I dug into types. Looks like fixing this is super simple: - type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> |
+ type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | ReadonlyArray<Serializable> |
{
[key: PropertyKey]: Serializable;
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>; |
This fixed the issue! |
@brophdawg11 @jacob-ebey Can this me merged upstream? At the moment, I have to patch local node_modules every time I update Remix. |
|
That's great news, but apps that currently rely on |
It's an unstable API not intended for production use. |
What How do I type them? |
They have been completely removed and not longer required, but the single fetch types need to be enabled, although type inference is broken for me (see #9970). |
This issue has been resolved with 2.12.0 https://stackblitz.com/edit/remix-run-remix-xnwymd |
@0t4u see #9969 (comment) |
Reproduction
https://stackblitz.com/edit/remix-run-remix-msgs25?file=app%2Froutes%2F_index.tsx
System Info
Used Package Manager
pnpm
Expected Behavior
No type error.
Actual Behavior
Getting error:
The text was updated successfully, but these errors were encountered: