File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -2867,11 +2867,23 @@ namespace ts {
28672867 if ( symbol . escapedName === InternalSymbolName . ExportEquals || symbol . escapedName === InternalSymbolName . Default ) {
28682868 // Name of "export default foo;" is "foo". Name of "export default 0" is the filename converted to camelCase.
28692869 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 ) ;
28712871 }
28722872 return symbol . name ;
28732873 }
28742874
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+
28752887 /**
28762888 * Useful to check whether a string contains another string at a specific index
28772889 * 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