You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Maximum call stack size exceeded when compiling tsx #46021
Compilation of tsx file throws generic error RangeError: Maximum call stack size exceeded. When the file doesn't contain any tsx element the compilation works as expected.
RangeError: Maximum call stack size exceeded
at Object.isFunctionLikeOrClassStaticBlockDeclaration (\node_modules\typescript\lib\tsc.js:9813:27)
at isBlockScope (\node_modules\typescript\lib\tsc.js:11161:28)
at \node_modules\typescript\lib\tsc.js:11242:73
at Object.findAncestor (\npm\node_modules\typescript\lib\tsc.js:9189:26)
at Object.getEnclosingBlockScopeContainer (\npm\node_modules\typescript\lib\tsc.js:11242:19)
at checkNestedBlockScopedBinding (\npm\node_modules\typescript\lib\tsc.js:57015:32)
at checkIdentifier (\npm\node_modules\typescript\lib\tsc.js:56921:13)
at checkExpressionWorker (\npm\node_modules\typescript\lib\tsc.js:63702:28)
at checkExpression (\npm\node_modules\typescript\lib\tsc.js:63657:38)
at checkJsxExpression (\npm\node_modules\typescript\lib\tsc.js:59059:28)
#43183 skips nodes whose parents are JSX elements, but that doesn't apply to JSXExpression's expressions. I don't know if it should.
Edit: Exempting the expression of a JSXExpression makes the below test pass.
(by adding !(isJsxExpression(node.parent) && node.parent.expression === node) && to hasNonBindingPatternContextualTypeWithNoGenericTypes)
Here's the test case from the playground link:
interfaceIData<MenuItemVariantextendsListItemVariant=ListItemVariant.OneLine>{menuItemsVariant?: MenuItemVariant;}functionMenu<MenuItemVariantextendsListItemVariant=ListItemVariant.OneLine>(data: IData<MenuItemVariant>){constlistItemVariant=data.menuItemsVariant??ListItemVariant.OneLine;// Non-tsx version compiles to js/jsx as expected//return ListItem({variant: listItemVariant});// tsx version doesn't compile and throws error as can be seen in devtools/consolereturn<ListItemvariant={listItemVariant}/>;}typeIListItemData={variant: ListItemVariant.Avatar;}|{variant: ListItemVariant.OneLine;};enumListItemVariant{OneLine,Avatar,}functionListItem(_data: IListItemData){returnnull;}
Activity
sandersn commentedon Oct 4, 2021
Broken by #43183
sandersn commentedon Oct 4, 2021
#43183 skips nodes whose parents are JSX elements, but that doesn't apply to JSXExpression's expressions. I don't know if it should.
Edit: Exempting the expression of a JSXExpression makes the below test pass.
(by adding
!(isJsxExpression(node.parent) && node.parent.expression === node) &&to hasNonBindingPatternContextualTypeWithNoGenericTypes)Here's the test case from the playground link: