-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
🔎 Search Terms
"Maximum call stack size exceeded". There are many issues referencing this, but most seem like different bugs from this, and I don't see any that have a simple repro like I provide here.
🕗 Version & Regression Information
I tested in these versions:
- Untestable in 4.6.4 and earlier (the repro code causes a syntax error)
- Fails in 4.7.4.
- Fails in 4.8.4.
- Fails in 4.9.5 (current release as of this report)
- Fails in 5.0.0-dev.20230214 (current "next" as of this report)
⏯ Playground Link
Playground link with relevant code Load it up, hit "Run", then look at your browser's dev console to see that the compiler blew the stack.
💻 Code
function f<T>(args: typeof f<T>):T { return args; }
🙁 Actual behavior
The compiler itself throws RangeError: Maximum call stack size exceeded
. E.g.:
$ cat temp.ts
function f<T>(args: typeof f<T>):T { return args; }
$ npx tsc temp.ts
/Users/grb/proj/execprog/node_modules/typescript/lib/tsc.js:99612
throw e;
^
RangeError: Maximum call stack size exceeded
🙂 Expected behavior
The code either compiles or gives a type error.
RyanCavanaugh
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue