Description
Bug Report
5.0.4
used to work fine after upgrading to the current latest version 5.1.3
. Very slow builds and eventually crashes. My root-cause seems to be a circular issue of some sort with tsc.
Seems like tsc can't handle interface definition files anymore, in this case from lodash
?
node_modules/@types/lodash/common/common.d.ts:194:15 - error TS2589: Type instantiation is excessively deep and possibly infinite.
194 interface Object<T> extends LoDashImplicitWrapper<T> {
~~~~~~
node_modules/@types/lodash/common/common.d.ts:206:15 - error TS2430: Interface 'ObjectChain<T>' incorrectly extends interface 'LoDashExplicitWrapper<T>'.
The types returned by 'entries().pop()' are incompatible between these types.
Type 'CollectionChain<string | T[keyof T]>' is missing the following properties from type 'ObjectChain<[string, any]>': assign, assignIn, assignInWith, assignWith, and 11 more.
206 interface ObjectChain<T> extends LoDashExplicitWrapper<T> {
~~~~~~~~~~~
My workaround was adding "skipLibCheck": true
to the tsconfig.json did mitigate the issue for now.
node_modules/@types/lodash/common/common.d.ts:194:15 - error TS2589: Type instantiation is excessively deep and possibly infinite.
194 interface Object<T> extends LoDashImplicitWrapper<T> {
~~~~~~
node_modules/@types/lodash/common/common.d.ts:206:15 - error TS2430: Interface 'ObjectChain<T>' incorrectly extends interface 'LoDashExplicitWrapper<T>'.
The types returned by 'entries().pop()' are incompatible between these types.
Type 'CollectionChain<string | T[keyof T]>' is missing the following properties from type 'ObjectChain<[string, any]>': assign, assignIn, assignInWith, assignWith, and 11 more.
206 interface ObjectChain<T> extends LoDashExplicitWrapper<T> {
~~~~~~~~~~~
Workaround for me was to add: "skipLibCheck": true
to the tsconfig.json did mitigate the issue for now.
🔎 Search Terms
- Crash
- OOME
- 5.1
- Heap
🕗 Version & Regression Information
I also tried the latest next
tag, with the same issues.
- This is a crash
- This changed between versions 5.0.x and 5.1.x
⏯ Playground Link
The "Type is excessively deep" is being triggered in a project that includes this the @types/lodash
, so in your package.json be sure you have the dependency:
"dependencies": {
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/lodash": "^4.14.195"
}
Be sure that you did NOT set skipLibCheck
to true
. So keep it to false, otherwise the d.ts
files will be ignored.
Execute via: NODE_OPTIONS=--max-old-space-size=8192 tsc --pretty --diagnostics --extendedDiagnostics --incremental false
💻 Code
See below, it doesn't involve my code.
🙁 Actual behavior
JavaScript heap out of memory, because of circular/ too deep dependency?
node_modules/@types/lodash/common/common.d.ts:194:15 - error TS2589: Type instantiation is excessively deep and possibly infinite.
194 interface Object<T> extends LoDashImplicitWrapper<T> {
~~~~~~
node_modules/@types/lodash/common/common.d.ts:206:15 - error TS2430: Interface 'ObjectChain<T>' incorrectly extends interface 'LoDashExplicitWrapper<T>'.
The types returned by 'entries().pop()' are incompatible between these types.
Type 'CollectionChain<string | T[keyof T]>' is missing the following properties from type 'ObjectChain<[string, any]>': assign, assignIn, assignInWith, assignWith, and 11 more.
206 interface ObjectChain<T> extends LoDashExplicitWrapper<T> {
~~~~~~~~~~~
Found 2 errors in 1 file.
Errors Files
2 node_modules/@types/lodash/common/common.d.ts:194
Files: 253
Lines of Library: 9875
Lines of Definitions: 73521
Lines of TypeScript: 3999
Lines of JavaScript: 0
Lines of JSON: 0
Lines of Other: 0
Identifiers: 117524
Symbols: 4856905
Types: 1093043
Instantiations: 11883895
Memory used: 2379915K
Assignability cache size: 230447
Identity cache size: 772
Subtype cache size: 398
Strict subtype cache size: 10
I/O Read time: 0.15s
Parse time: 1.17s
ResolveModule time: 0.21s
ResolveTypeReference time: 0.03s
ResolveLibrary time: 0.02s
Program time: 1.70s
Bind time: 0.47s
Check time: 239.51s
transformTime time: 0.05s
Source Map time: 0.02s
commentTime time: 0.04s
I/O Write time: 0.02s
printTime time: 0.37s
Emit time: 0.37s
Total time: 242.05s
🙂 Expected behavior
No crashes or errors during tsc
!