-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Excessive stack depth comparing types 'FlatArray<Arr, ?>' and 'FlatArray<Arr, ?>'. #43249
Comments
@kudryavtsev-dmitry Thanks bud, you saved my day :). Been getting this error all over my react project for almost a week! :( |
Typescript nightly for vscode throw this error v4.3.20210314 |
I have a simple fix, but I don’t think it gets to the core of the issue. Via bisecting, I found that the problem was introduced in #30639 (cc @weswigham). Here’s a minimal repro: // @lib: es2019
interface MiddlewareArray<T> extends Array<T> {}
declare function configureStore(options: { middleware: MiddlewareArray<any> }): void;
declare const defaultMiddleware: MiddlewareArray<any>;
configureStore({
middleware: [...defaultMiddleware], // Should not error
}); The problem starts when we need to know if I haven’t yet dug into why #30639 causes that comparison to overflow, but it seemed like we should really never have to do that work at all—if a type has |
Confirmed my |
I was having the same issue with + <>
{data.feeds.map((item, index) => {
return <div key={someKey}>{JSON.stringify(item)}</div>
})}
+ </> |
But this is a perfectly valid react pattern, you should not need that as soon as you have a parent component |
Having this problem in 4.3.0-dev.20210327 in many JSX code |
I ran into this when trying the const repro_43249 = (value) => {
if (typeof value !== "string") {
throw new Error("No");
}
const match = value.match(/anything/) || [];
const [extracted] = match;
// ~~~~~~~~~^ Excessive stack depth comparing types 'FlatArray<Arr, ?>' and 'FlatArray<Arr, ?>'
}; You can reproduce this with the following {
"compilerOptions": {
"lib": ["ES2019"]
}
} Curiously,
I notice that |
This attributes works perfectly but it's unnecessary as pointed out before |
Trying to understand the current state of this bug. It's still occurring as of the 3/30 nightly - I just ran into with a string interpolation in JSX and was able to fix with the "wrap it in a React.fragment" as suggested. Is there currently a PR open for a fix or are we at least vaguely sure of why this is happening? (I know @andrewbranch mentioned having a possible solution above.) |
so did i, though it may be the same thing #43493 |
With #43527 we should have this issue taken care of for good. |
zod is incompatible with Typescript 4.3.x due a change in 4.3 for evaluating deep complex types. Since we do not use any 4.3 features (yet), lock typescript package to 4.2 until this is fixed see microsoft/TypeScript#43249, colinhacks/zod#443, colinhacks/zod#473, microsoft/TypeScript#44299
TS and JS Grammar Extension version: ms-vscode.vscode-typescript-next v4.3.20210312
Trying to use configureStore with middlewares, getting the following error:
A couple days ago it was fine.
Also getting a lot of similar Excessive stack depth errors for other parts of the code.
Code
The text was updated successfully, but these errors were encountered: