TypeScript: [tsc] Regression causing 'Maximum call stack size exceeded'
Hopefully this one can get fixed quickly since it is a pretty major regression. I spent a lot of time figuring out exactly which version range is causing the failure as well as trying to figure out a minimal test case.
TypeScript Version:
Failure at version: 3.6.0-dev.20190807
and above.
Everything works: 3.6.0-dev.20190806
and lower.
Code
To run:
yarn
./node_modules/.bin/tsc
Expected behavior:
No error.
Actual behavior:
tsc-fail/node_modules/typescript/lib/tsc.js:75299
throw e;
^
RangeError: Maximum call stack size exceeded
at Object.getObjectFlags (tsc-fail/node_modules/typescript/lib/tsc.js:10227:28)
at isExcessPropertyCheckTarget (tsc-fail/node_modules/typescript/lib/tsc.js:42328:51)
at Object.every (tsc-fail/node_modules/typescript/lib/tsc.js:295:22)
at isExcessPropertyCheckTarget (tsc-fail/node_modules/typescript/lib/tsc.js:42331:44)
at isKnownProperty (tsc-fail/node_modules/typescript/lib/tsc.js:42317:52)
at hasCommonProperties (tsc-fail/node_modules/typescript/lib/tsc.js:37523:21)
at isRelatedTo (tsc-fail/node_modules/typescript/lib/tsc.js:36276:58)
at typeRelatedToSomeType (tsc-fail/node_modules/typescript/lib/tsc.js:36458:35)
at isRelatedTo (tsc-fail/node_modules/typescript/lib/tsc.js:36300:34)
at isPropertySymbolTypeRelated (tsc-fail/node_modules/typescript/lib/tsc.js:37137:28)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 17 (2 by maintainers)
Commits related to this issue
- fix for https://github.com/microsoft/TypeScript/issues/33460 — committed to Vincit/objection.js by koskimas 5 years ago
Just use MikroORM v3, seriously.
Same error occured to me, I tried updating typescript to 4.5.2 but it didn’t help. My objection version is 3.0.0 and knex version is 0.95.14
This also happens with objection.js typings. I don’t know if this helps, but you can reproduce it like this:
Using the package.json version
3.5.3
worksI was able to find out that this monstrosity of a type is the culprit:
Oh, the original reproduction was also done using objection typings 😄
I also got the “Maximum call stack size exceeded” using Objection on version 3.0.0 and Typescript on version 4.4.4. I’ll try to provide a reproduction later.
Still “Maximum call stack size exceeded” with objection
This error is produced also in latest build. I reach it finally too. I thing its about toobig projects. But where is the limit?
@orta I used the included test project and confirmed it no longer errors in
Version 3.9.0-dev.20200414
I just found out that changing this
into this
fixes the problem.
Also note that @lookfirst’s reproduction uses objection 1.6.9 while the above types and my repro is with objection 2.0 typings which have been completely rewritten from scratch. So this fix only applies to my repro.