-
Notifications
You must be signed in to change notification settings - Fork 13k
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 outputFix 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
- property access call
π Version & Regression Information
Works on 4.3.5
, crashes on 4.4.0-beta
, 4.4.1-rc
, 4.4.2
, 4.4.3
, 4.5.0-dev.20210910
.
β― Playground Link
Playground link with relevant code
π» Code
const obj = {
fn: () => true
};
if (a) { } // crashes if `a` is used in the condition
const a = obj.fn();
There will be no crash if a
is declared without accessing the obj
property
const obj = {
fn: () => true
};
const callFn = () => obj.fn();
if (a) { } // now it doesn't crash
const a = callFn();
π Actual behavior
$ yarn tsc test.ts
/project/node_modules/typescript/lib/tsc.js:92656
throw e;
^
RangeError: Maximum call stack size exceeded
at /project/node_modules/typescript/lib/tsc.js:9125:63
at getCombinedFlags (/project/node_modules/typescript/lib/tsc.js:9103:21)
at Object.getCombinedNodeFlags (/project/node_modules/typescript/lib/tsc.js:9125:16)
at getDeclarationNodeFlagsFromSymbol (/project/node_modules/typescript/lib/tsc.js:59070:44)
at checkIdentifier (/project/node_modules/typescript/lib/tsc.js:56890:46)
at checkExpressionWorker (/project/node_modules/typescript/lib/tsc.js:63702:28)
at checkExpression (/project/node_modules/typescript/lib/tsc.js:63657:38)
at checkNonNullExpression (/project/node_modules/typescript/lib/tsc.js:59167:37)
at checkPropertyAccessExpression (/project/node_modules/typescript/lib/tsc.js:59212:85)
at checkExpressionWorker (/project/node_modules/typescript/lib/tsc.js:63734:28)
π Expected behavior
Should report the error Block-scoped variable 'a' used before its declaration.
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 outputFix AvailableA PR has been opened for this issueA PR has been opened for this issue