Skip to content

Maximum call stack size exceeded for getTypeAtFlowNode in Large File #14314

Closed
@mattbierner

Description

@mattbierner

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code
Discovered while trying to work around facebook/react-native#12590

For a large TS file that looks like:

const data = {} as any

data["a"] = "AH0";
data["a(1)"] = "EY1";
data["a's"] = "EY1 Z";
data["a."] = "EY1";
data["a.'s"] = "EY1 Z";
data["a.s"] = "EY1 Z";
... 100,000 + lines

Compile the file on its own with tsc

Here's the complete file: https://gist.githubusercontent.com/mattbierner/34dbc249be0ebddedcc275d0ff40281b/raw/985dbbfba9a5db89f9cea618ce3c885ccc46ef8b/cmu.js

Bug

/XXX/node_modules/typescript/lib/tsc.js:51296
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at isMatchingReference (/XXX/node_modules/typescript/lib/tsc.js:27613:37)
    at getTypeAtFlowAssignment (/XXX/node_modules/typescript/lib/tsc.js:28150:21)
    at getTypeAtFlowNode (/XXX/node_modules/typescript/lib/tsc.js:28101:32)
    at getTypeAtFlowArrayMutation (/XXX/node_modules/typescript/lib/tsc.js:28178:36)
    at getTypeAtFlowNode (/XXX/node_modules/typescript/lib/tsc.js:28123:32)
    at getTypeAtFlowArrayMutation (/XXX/node_modules/typescript/lib/tsc.js:28178:36)
    at getTypeAtFlowNode (/XXX/node_modules/typescript/lib/tsc.js:28123:32)
    at getTypeAtFlowArrayMutation (/XXX/node_modules/typescript/lib/tsc.js:28178:36)
    at getTypeAtFlowNode (/XXX/node_modules/typescript/lib/tsc.js:28123:32)
    at getTypeAtFlowArrayMutation (/XXX/node_modules/typescript/lib/tsc.js:28178:36)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions