TypeScript Version: 3.9.0-dev.20200319
Search Terms:
call stack exceeded
Code
exporttypeA="number"|"null"|A[];exporttypeF<T>=nullextendsT
? [F<NonNullable<T>>,"null"]
: Textendsnumber
? "number"
: never;exporttypeG<T>={[kinkeyofT]: F<T[k]>};interfaceK{b: number|null;}constgK: {[keyinkeyofK]: A}={b: ["number","null"]};functionfoo<T>(g: G<T>): T{return{}asany;}foo(gK);Expected behavior:
Not crashing the compiler
Actual behavior:
% ./node_modules/.bin/tsc --version
Version 3.9.0-dev.20200319
% ./node_modules/.bin/tsc bug.ts
...node_modules/typescript/lib/tsc.js:81982
throw e;
^
RangeError: Maximum call stack size exceeded
at makeCompositeTypeMapper (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:38964:41)
at combineTypeMappers (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:38974:30)
at instantiateTypeWorker (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:39273:62)
at instantiateType (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:39220:26)
at getMappedType (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:38952:63)
at /home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:39187:92
at Object.map (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:335:29)
at getConditionalTypeInstantiation (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:39187:40)
at instantiateTypeWorker (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:39273:24)
at instantiateType (/home/plol/src/wtf/bug/node_modules/typescript/lib/tsc.js:39220:26)
TypeScript Version: 3.9.0-dev.20200319
Search Terms:
call stack exceeded
Code
Expected behavior:
Not crashing the compiler
Actual behavior: