-
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
RangeError: Map maximum size exceeded
with typescript@4.8.1-rc
#50290
Comments
I also tried |
@weswigham Did you bisect to identify the commit that caused the issue? |
FWIW with |
@ahejlsberg Yea, it looks like it's 51b346d, so the |
I researched the cause of the assignability relation cache size explosion in 4.8 and later. The original repro contains this helper function in the declare const isTypedNode:
<T extends NodePath['type']>(type: T) => (p: NodePath<Node>) => p is NodePath<Extract<Node, { type: T }>>; where get<K extends keyof T>(
key: K,
context?: boolean | TraversalContext,
): T[K] extends Array<Node | null | undefined>
? Array<NodePath<T[K][number]>>
: T[K] extends Array<Node | null | undefined> | null | undefined
? Array<NodePath<NonNullable<T[K]>[number]>> | NodePath<null | undefined>
: T[K] extends Node | null | undefined
? NodePath<T[K]>
: never; The use of inline anonymous conditional types means that we always relate structurally (instead of computing variance and relating type arguments). Futhermore, we produce intersections in the true branches of the conditional types because we intersect with the The best way to fix this issue is to change the generic get<K extends keyof T>(key: K, context?: boolean | TraversalContext): NodePathResult<T[K]>; where export type NodePathResult<T> =
(Extract<T, Node | null | undefined> extends never ? never : NodePath<Extract<T, Node | null | undefined>>) |
(T extends Array<Node | null | undefined> ? Array<NodePath<T[number]>> : never); This fixes the issue and generally improves check time with both earlier and later versions than 4.8. It also is a more correct type becase it can handle combinations of I will submit a PR to EDIT: Given we now have a fix in #50397 I won't be submitting a PR to Babel. |
Hopefully fixed in 4.8.3? |
Is the workaround to submit a PR to Babel? |
Yes, that should do it. |
Since it's just a |
The workaround was added by @Andarist: DefinitelyTyped/DefinitelyTyped#62001 However on 4.9.4 this still seems to occur. When running
Found the type that's causing the issue: import { IconProp } from "@fortawesome/fontawesome-svg-core";
interface IconWrapperProps {
children: IconProp; // <---
} When changing that to |
@johnvankeulen how did you find the type that caused this issue? |
@johnvankeulen yo, thx for the comment, had the same issue and it was really hard to find where since the compiler was crashing I would love for the compiler (5.1.6) to at least not crash :/ I was getting (for google searchers) this:
In node 16, I tried upgrading node to latest LTS (18) and got the max size stack reported here |
Bug Report
π Search Terms
Map maximum size exceeded
π Version & Regression Information
β― Playground Link
Playground link with relevant codeI don't know what causes this exactly, but the repo isn't too big:
adazzle/react-data-grid#2988
π» Code
I don't know what code causes the crash. Please see this branch:
adazzle/react-data-grid#2988
π Actual behavior
π Expected behavior
No crash.
The text was updated successfully, but these errors were encountered: