-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Maximum call stack size exceeded for getTypeAtFlowNode in Large File #14314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Every statement is considered a "narrowing" expression, and that triggers more analysis, if the compiler goes far enough in the statement list, it runs out of stack space. have you considered writing it as an object literal? const data = {
"a": "AH0",
"a(1)": "EY1",
"a's": "EY1 Z",
"a.": "EY1",
"a.'s": "EY1 Z",
"a.s": "EY1 Z",
...
} or adding a type annotation with an index signature, e.g. |
Thanks @mhegazy. I actually started with a json object but ran into some problems with react-native, which is why I tried to convert it to this format. Obviously the code is not terribly practical, but I also wasn't trying to break typescript or anything when doing this. Adding an index signiture like so:
Does not fix things. I still see exceptions such as:
and
|
This is particularly problematic because it tends to break long locale files in large projects. |
Still occurring on As @atifsyedali said, this is quite problematic. I'm working with legacy code that has +5000 lines of assignments to a dictionary.
|
As a workaround, I'm using arrays and assigning later to the dictionary: let dict: any = {};
let values = [
["key", "value"],
["key", "value"],
// ... 5000+ entries
];
for (let i=0; i<values.length; i++) {
dict[ values[i][0] ] = values[i][1];
} |
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:
Compile the file on its own with
tsc
Here's the complete file: https://gist.githubusercontent.com/mattbierner/34dbc249be0ebddedcc275d0ff40281b/raw/985dbbfba9a5db89f9cea618ce3c885ccc46ef8b/cmu.js
Bug
The text was updated successfully, but these errors were encountered: