Repository navigation
TSC Crash: Javascript Object assignment #33006
Copy link
Copy link
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
TypeScript Version: 3.4.5
Search Terms:
tsc crash for .js where curly bracket object assignment is used in conjunction with OR assignment
Code
tsconfig:
..."allowJs" : true...
simple-js-file.js:
var NameSpace = NameSpace || { Shared: {} }; //DOES NOT WORK
Equivalent works:
var NameSpace = NameSpace || {};
NameSpace.Shared = {}; // WORKS
Expected behavior:
Typescript to compile the .js file to the out folder (Like the second example)
Actual behavior:
tsc : C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:72970
At line:1 char:1
+ tsc
+ ~~~
+ CategoryInfo : NotSpecified: (C:\Users\TJevon...ib\tsc.js:72970:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
throw e;
^
RangeError: Maximum call stack size exceeded
at checkPropertyAccessExpression (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:41094:47)
at checkExpressionWorker (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:44380:28)
at checkExpression (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:44317:38)
at checkTruthinessExpression (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:46358:24)
at checkBinaryLikeExpression (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:43762:28)
at checkBinaryExpression (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:43753:20)
at checkExpressionWorker (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:44420:28)
at checkExpression (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:44317:38)
at checkExpressionCached (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:44106:38)
at getInitializerTypeFromAssignmentDeclaration (C:\Users\TJevon\AppData\Roaming\npm\node_modules\typescript\lib\tsc.js:29597:97)
Playground Link:
Related Issues:
Reactions are currently unavailable
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
Activity
sandersn commentedon Oct 15, 2019
terrance00 I tried this program:
with this command line:
And didn't get a crash on any version of TS 2.2-3.6. Can you share your tsconfig that has the crash?
terrance00 commentedon Oct 16, 2019
Nathan Shively-Sanders (@sandersn)
Sorry, It seems to be when you actually use that anonymous object "shared", and also - you have to go one level deeper:
Just tested this snippet:
sandersn commentedon Oct 17, 2019
Thanks, that's it!
sandersn commentedon Oct 17, 2019
Crashes from 3.3 onward.
Fix stack overflow in circular assignment declaration
Fix stack overflow in circular assignment declaration (#34543)