-
Notifications
You must be signed in to change notification settings - Fork 12.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
[2.4.1] stricter generic checks causes out-of-memory crash #16777
Comments
Same problem - different project. I'm using the angular template from the "Microsoft ASP.NET Core JavaScript Services" @ https://github.com/aspnet/JavaScriptServices, and was getting the exact same error while using Webpack's HMR in Node. In trying to reproduce the problem from a minimal startup, I may have solved the problem in my case. It appears that the rxjs/Subject.d.ts file no longer has valid definitions with the improved generic typechecking in v2.4.1. When I try a stock template, I get the following error in the browser:
Alright, so that leads me to the skipLibCheck flag in the tsconfig.json file. The template includes the skipDefaultLibCheck flag set to true, but doesn't include the skipLibCheck flag. Double checking the flags at https://www.typescriptlang.org/docs/handbook/compiler-options.html, skipDefaultLibCheck is now deprecated in favor of skipLibCheck. So, I simply replaced skipDefaultLibCheck with skipLibCheck (still set as true). That fixed the browser error about the d.ts file, and it also fixed the heap out of memory error in node (I'm guessing Webpack was silently failing on build because the now invalid d.ts file was being included, which led to the memory issue in node). I checked your tsconfig.json file, and you don't have the skipLibCheck flag set to true. Maybe give that a shot and see if it fixes your problem too? |
Affects me too when I bumped TS to 2.4.1. Works fine with 2.3.4 |
@IrickNcqa you're correct! Setting up |
I can confirm that setting |
Nevertheless, shouldn't this be considered a regression, since we did not need the |
@myknbani regardless of anything, tsc should never crash like it does in this bug. at the very least, even if the type definitions are invalid, it should display a proper error message. That said, from my understanding, |
I'd say it's to be expected that stricter type checking would result in some new errors in existing type definition files. Given the above, it's clear rxjs needs to update their d.ts file, and in another thread it looks like the Redux d.ts is going to need an update also. There will probably be a lot of others. So this will probably boil down to filing issues with the third parties to update their definition files or fixing ourselves and submitting. The major packages will probably be updated fairly quickly. TS v2.4.1 only dropped 20 hours ago - so they definitely haven't had time yet. A bad d.ts file leading to a out of memory error is bizarre. Agree that needs improvement. |
Looks like the heap error has been around. I just saw it in the v2.4.2 milestone, but no discussion of the skipLibCheck there. https://github.com/Microsoft/TypeScript/issues/16234 |
for my app i'm not even sure which dependencies cause the issue. I suspect maybe immutable but I reproduce also removing that dependency. So a good error message should tell us which dependency is to blame otherwise it's going to be complicated to fix. what I'd really like to know as well is, what is the downside of skipLibCheck? does that make the type-checking of the libraries "lazy" and... if you don't use the feature which is badly mapped in the type definition then you have no problem and no regression in type-safety from 2.3. If you do use the feature which is badly mapped, then you still get the crash.. OR does it disable some type-safety and you are worse off on 2.4 with that option compared to staying on 2.3? but yeah whether it's #1 or #2 it's probably better not enabling the option and sticking to 2.3 until the type definitions are ported to 2.4... |
This bug is percolating all over the place. Just for rxjs... |
I did a git bisect and found that it is a bug in the stricter generic checks introduced after 2.4.0 (at commit 368e5af). For me, |
By the way @IrickNcqa, #16234 is almost certainly a different issues since it predates the stricter generic type checking. There are lots of ways the Typescript compiler can run out of memory! |
@sandersn Just upgraded from 2.3.x to 2.4.1 and started getting the same error. I can confirm that adding the |
I see this bug is not in the 2.4.2 milestone. I think it should be, because it hampers libraries becoming compatible to 2.4, since it makes it hard for them to understand what's wrong with their type definitions. It seems like a pretty big regression. |
Same problem for me. I tried with version 2.3.4, 2.4.1,
|
#17984 fixes the crashes I observed trying to compile ng-typeview and monet. For the others, you can typescript@next starting tomorrow to see whether the fix applies. |
@sandersn - using:
I'm getting an a "heap out of memory" crash:
If I set |
@myitcv mind filing a new issue and sharing your project |
@mhegazy - happy to file a new issue, but we can't share the code unfortunately. |
We would be happy to sign any NDA required to get access to the source. without the sources, or a sample reproduction of the issue, i am afraid there is not much we can do. |
@myitcv please do file a new issue to track this. Even if you can't share the code, we are planning to improve the way the compiler fails when the cache grows too large, so you may be able to debug the problem yourself. In the meantime, |
@sandersn - since #18231 landed (although I haven't narrowed it down to that exact PR, that just happened to be a significant PR that I saw land) the problem has gone away; no At this point, the only outstanding issue prevent us moving back to the nightly build is something else you're working on, namely immutable-js/immutable-js#1285. I wonder if you or @leebyron can help move that along? |
Immutable is looking for new maintainers right now so I'm not sure @leebyron will have time. One possibility is to decouple the types and put immutable-js's types back on DefinitelyTyped. But that's not a good long-term strategy without agreement from the maintainers of immutable. |
That's not the conclusion I took from @leebyron's comments in immutable-js/immutable-js#1215 (comment). There are of course ways in which I can use your proposed PR changes for now. But I was hoping given that we're on Typescript 2.5 and that these breaking changes landed in 2.4 that we'd be able to move things along. |
I experience this issue in [email protected] when using [email protected] |
@amitm02 this is rather an old issue. please file a new ticket, and give us enough context to be able to diagnose the issue. |
TypeScript Version: 2.4.1
node version: v6.10.3, linux x86-64
Code
https://github.com/emmanueltouzery/ng-typeview
clone the project, run:
Expected behavior:
the project compiled just fine up to typescript 2.3.
Actual behavior:
with 2.4.1, I get an out of memory at every run:
I've seen similar bug reports but no obvious solution (a bug suggested to increase the typescript dependency version, tried to increase that to 2.4.1, didn't help, tried to remove the typedoc dependency which has a transitive dependency to typescript, that didn't help either), and in some of these bugs typescript maintainers ask for the source and reporters couldn't provide it: here I can.
The text was updated successfully, but these errors were encountered: