File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2867,11 +2867,23 @@ namespace ts {
2867
2867
if ( symbol . escapedName === InternalSymbolName . ExportEquals || symbol . escapedName === InternalSymbolName . Default ) {
2868
2868
// Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase.
2869
2869
return firstDefined ( symbol . declarations , d => isExportAssignment ( d ) && isIdentifier ( d . expression ) ? d . expression . text : undefined )
2870
- || codefix . moduleSymbolToValidIdentifier ( Debug . checkDefined ( symbol . parent ) , scriptTarget ) ;
2870
+ || codefix . moduleSymbolToValidIdentifier ( getSymbolParentOrFail ( symbol ) , scriptTarget ) ;
2871
2871
}
2872
2872
return symbol . name ;
2873
2873
}
2874
2874
2875
+ function getSymbolParentOrFail ( symbol : Symbol ) {
2876
+ return Debug . checkDefined (
2877
+ symbol . parent ,
2878
+ `Symbol parent was undefined. Flags: ${ Debug . formatSymbolFlags ( symbol . flags ) } . ` +
2879
+ `Declarations: ${ symbol . declarations ?. map ( d => {
2880
+ const kind = Debug . formatSyntaxKind ( d . kind ) ;
2881
+ const inJS = isInJSFile ( d ) ;
2882
+ const { expression } = d as any ;
2883
+ return ( inJS ? "[JS]" : "" ) + kind + ( expression ? ` (expression: ${ Debug . formatSyntaxKind ( expression . kind ) } )` : "" ) ;
2884
+ } ) . join ( ", " ) } .`) ;
2885
+ }
2886
+
2875
2887
/**
2876
2888
* Useful to check whether a string contains another string at a specific index
2877
2889
* without allocating another string or traversing the entire contents of the outer string.
You can’t perform that action at this time.
0 commit comments