mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #17996 from Microsoft/fix16681
Fix crash when exporting class without name
This commit is contained in:
@@ -1204,7 +1204,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (hasModifier(decl, ModifierFlags.Export)) {
|
||||
const exportName = hasModifier(decl, ModifierFlags.Default) ? createIdentifier("default") : decl.name;
|
||||
const exportName = hasModifier(decl, ModifierFlags.Default) ? createIdentifier("default") : getDeclarationName(decl);
|
||||
statements = appendExportStatement(statements, exportName, getLocalName(decl), /*location*/ decl);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace ts {
|
||||
else {
|
||||
// export class x { }
|
||||
const name = (<ClassDeclaration>node).name;
|
||||
if (!uniqueExports.get(unescapeLeadingUnderscores(name.escapedText))) {
|
||||
if (name && !uniqueExports.get(unescapeLeadingUnderscores(name.escapedText))) {
|
||||
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
|
||||
uniqueExports.set(unescapeLeadingUnderscores(name.escapedText), true);
|
||||
exportedNames = append(exportedNames, name);
|
||||
|
||||
Reference in New Issue
Block a user