Omit producing "JavaScript heap out of memory" with v3.3
See original GitHub issueTypeScript Version: 3.4.0-dev.201xxxxx
- 3.3.0-rc
- 3.3.3333
- 3.4.0-dev.20190223
Search Terms: Omit
Code
// using "@types/react": "^16.8.4"
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type XXX = Omit<React.HTMLAttributes<HTMLElement>, 'title'>; // <= this alias is not working
Expected behavior: It should work as early versions, last tested v3.2.4
Actual behavior: Compiler throws “JavaScript heap out of memory” and same happens with VSCode Intellisense (stuck for minutes without proper answer).
Playground Link:
Tested code working with playground 3.3. (pasting @types/react at bottom), too big to share.
Related Issues:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (4 by maintainers)
Top Results From Across the Web
JavaScript Heap Out Of Memory Error
This error indicates high memory usage or a memory leak in your application. In this article, I cover different solutions to this problem....
Read more >Node.js heap out of memory
I resolved the problem by creating swap file using this url and set following environment variable. export NODE_OPTIONS=--max_old_space_size= ...
Read more >How to Fix JavaScript Heap Out of Memory Error
How to Fix JavaScript Heap Out of Memory on Windows · Open the Start menu, search for Advanced System Settings, and select the...
Read more >fatal error: reached heap limit allocation failed - javascript ...
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. Here's an example...
Read more >Javascript Heap Out Of Memory Npm Start - Floralab
Javascript Heap Out Of Memory Npm StartUse the npm install to Heap Out of Memory If you're having trouble installing a package with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just curious.
If you run
node --max-old-space-size=8192 ./node_modules/typescript/lib/tsc.js --diagnostics
, do you still get OOM?If it does complete, what does it say for
Memory used
? For example, for one of my projects, my output saysMemory used: 1310899K
. So, 1.3GBYep, this looks like a carbon copy of how #29949 works - the
Tag
of typekeyof JSX.IntrinsicElements
is a union of 110 items - to check all 110 of the possible tags, we union those signatures - meaning we intersect the arguments. We then intersect 110 ref types (which are allundefined | null | string | RefFunc<T> | RefObj<T>
) which becomes crazy costly with how we construct intersections, as it happens. What’s worse is that since there’s both the func and object types, they combine in strange and interesting ways - like, say we only were looking at a"input"
or a"button"
- well, that could have aref
that is a function which tags a"button"
ref param, but is also an object which takes an"input"
ref property. Or vice versa. Or both as params, or both as objects. From 2 effective inputs, we get a union of 4 output types - and this multiplication occurs for every element of the union. Running the numbers, the resulting union is supposed to have… 10^33 members or so?@ahejlsberg what do you think we should do for a intersection/union nesting where flattening the nesting would produce an absurd number of types? There’s a strong desire to check this pattern correctly, so I don’t think some kind of resource limit would work here; but at the same time, optimizing construction won’t cut it here - the sheer number of types scheduled to be produced by this flattening operation is huge (and since there’s a pair of object types, it doesn’t simplify nicely at all).