-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad output
Milestone
Description
TypeScript Version: 3.0.1+ (including [email protected])
Search Terms:
- Maximum callstack
- Stack overflow
Code
let foo = () => {}; // if you remove or change foo definition to not a function, bug disappears
let bar; // if you add type annotation here, bug disappears
while (1) // if you remove while, bug disappears
bar = ~foo(...bar); // if you remove unary or spread operator, bug disappears
// bar = || foo(...bar); // though this is a syntax error, it produces stack overflow also
Expected behavior:
Should compile with error report for spreading undefined
and/or leaving bar
as implicit any
Actual behavior:
Prints Maximum call stack size exceeded
.
Or if you run this script with ts-node:
Playground Link:
This is weird, playground from typescriptlang.com seems to work well, but playground from typescript-play.js.org produces the stack overflow as it does locally in my terminal (Ubuntu 18.04.2 LTS). You may see the error for the second playground in your browser console.
Related Issues:
#25149 To some degree
uhyo
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad output