TypeScript Version: 2.7.0-dev.201xxxxx
Code
// test.tsexportclassTest{publicstaticcreateSubclass(){returnclassextendsTest{};}}Expected behavior:
TSC should not fail to compile with --declaration.
Actual behavior:
TSC fails with Maximum call stack size exceeded:
> tsc --declaration test.ts /usr/local/lib/node_modules/typescript/lib/tsc.js:59538
throw e;
^
RangeError: Maximum call stack size exceeded
at writeKeyword (/usr/local/lib/node_modules/typescript/lib/tsc.js:21320:30)
at buildSignatureDisplay (/usr/local/lib/node_modules/typescript/lib/tsc.js:22591:21)
at writeObjectLiteralType (/usr/local/lib/node_modules/typescript/lib/tsc.js:22366:25)
at writeLiteralType (/usr/local/lib/node_modules/typescript/lib/tsc.js:22352:21)
at writeAnonymousType (/usr/local/lib/node_modules/typescript/lib/tsc.js:22246:33)
at writeType (/usr/local/lib/node_modules/typescript/lib/tsc.js:22098:25)
at buildTypeDisplay (/usr/local/lib/node_modules/typescript/lib/tsc.js:22061:24)
at buildReturnTypeDisplay (/usr/local/lib/node_modules/typescript/lib/tsc.js:22586:21)
at buildSignatureDisplay (/usr/local/lib/node_modules/typescript/lib/tsc.js:22601:17)
at writeObjectLiteralType (/usr/local/lib/node_modules/typescript/lib/tsc.js:22388:33)
More Details:
Seems like the error is not caused by extending the specific class that owns the static method, but it also fails with other bases:
// fails too:exportclassFoo{}exportclassTest{publicstaticcreateSubclass(){returnclassextendsFoo{};}}When the class expression is returned by an instance method though, TSC does not fail:
// works:exportclassTest{publiccreateSubclass(){returnclassextendsTest{};}}// result:exportdeclareclassTest{createSubclass(): {new(): {createSubclass(): any;};};}
TypeScript Version: 2.7.0-dev.201xxxxx
Code
Expected behavior:
TSC should not fail to compile with
--declaration.Actual behavior:
TSC fails with
Maximum call stack size exceeded:More Details:
Seems like the error is not caused by extending the specific class that owns the static method, but it also fails with other bases:
When the class expression is returned by an instance method though, TSC does not fail: