@@ -227,12 +227,13 @@ namespace ts {
227227        // Should not be called on a declaration with a computed property name, 
228228        // unless it is a well known Symbol. 
229229        function  getDeclarationName ( node : Declaration ) : string  { 
230-             if  ( node . name )  { 
230+             const  name  =  getNameOfDeclaration ( node ) ; 
231+             if  ( name )  { 
231232                if  ( isAmbientModule ( node ) )  { 
232-                     return  isGlobalScopeAugmentation ( < ModuleDeclaration > node )  ? "__global"  : `"${ ( < LiteralExpression > node . name ) . text }  ; 
233+                     return  isGlobalScopeAugmentation ( < ModuleDeclaration > node )  ? "__global"  : `"${ ( < LiteralExpression > name ) . text }  ; 
233234                } 
234-                 if  ( node . name . kind  ===  SyntaxKind . ComputedPropertyName )  { 
235-                     const  nameExpression  =  ( < ComputedPropertyName > node . name ) . expression ; 
235+                 if  ( name . kind  ===  SyntaxKind . ComputedPropertyName )  { 
236+                     const  nameExpression  =  ( < ComputedPropertyName > name ) . expression ; 
236237                    // treat computed property names where expression is string/numeric literal as just string/numeric literal 
237238                    if  ( isStringOrNumericLiteral ( nameExpression ) )  { 
238239                        return  nameExpression . text ; 
@@ -241,7 +242,7 @@ namespace ts {
241242                    Debug . assert ( isWellKnownSymbolSyntactically ( nameExpression ) ) ; 
242243                    return  getPropertyNameForKnownSymbolName ( ( < PropertyAccessExpression > nameExpression ) . name . text ) ; 
243244                } 
244-                 return  ( < Identifier  |  LiteralExpression > node . name ) . text ; 
245+                 return  ( < Identifier  |  LiteralExpression > name ) . text ; 
245246            } 
246247            switch  ( node . kind )  { 
247248                case  SyntaxKind . Constructor :
@@ -303,7 +304,7 @@ namespace ts {
303304        } 
304305
305306        function  getDisplayName ( node : Declaration ) : string  { 
306-             return  node . name  ? declarationNameToString ( node . name )  : getDeclarationName ( node ) ; 
307+             return  ( node   as   NamedDeclaration ) . name  ? declarationNameToString ( ( node   as   NamedDeclaration ) . name )  : getDeclarationName ( node ) ; 
307308        } 
308309
309310        /** 
@@ -366,8 +367,8 @@ namespace ts {
366367                        symbolTable . set ( name ,  symbol  =  createSymbol ( SymbolFlags . None ,  name ) ) ; 
367368                    } 
368369                    else  { 
369-                         if  ( node . name )  { 
370-                             node . name . parent  =  node ; 
370+                         if  ( ( node   as   NamedDeclaration ) . name )  { 
371+                             ( node   as   NamedDeclaration ) . name . parent  =  node ; 
371372                        } 
372373
373374                        // Report errors every position with duplicate declaration 
@@ -396,9 +397,9 @@ namespace ts {
396397                        } 
397398
398399                        forEach ( symbol . declarations ,  declaration  =>  { 
399-                             file . bindDiagnostics . push ( createDiagnosticForNode ( declaration . name  ||  declaration ,  message ,  getDisplayName ( declaration ) ) ) ; 
400+                             file . bindDiagnostics . push ( createDiagnosticForNode ( getNameOfDeclaration ( declaration )  ||  declaration ,  message ,  getDisplayName ( declaration ) ) ) ; 
400401                        } ) ; 
401-                         file . bindDiagnostics . push ( createDiagnosticForNode ( node . name  ||  node ,  message ,  getDisplayName ( node ) ) ) ; 
402+                         file . bindDiagnostics . push ( createDiagnosticForNode ( getNameOfDeclaration ( node )  ||  node ,  message ,  getDisplayName ( node ) ) ) ; 
402403
403404                        symbol  =  createSymbol ( SymbolFlags . None ,  name ) ; 
404405                    } 
@@ -439,9 +440,9 @@ namespace ts {
439440                //       and this case is specially handled. Module augmentations should only be merged with original module definition 
440441                //       and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed. 
441442                const  isJSDocTypedefInJSDocNamespace  =  node . kind  ===  SyntaxKind . JSDocTypedefTag  && 
442-                     node . name  && 
443-                     node . name . kind  ===  SyntaxKind . Identifier  && 
444-                     ( < Identifier > node . name ) . isInJSDocNamespace ; 
443+                     ( node   as   JSDocTypedefTag ) . name  && 
444+                     ( node   as   JSDocTypedefTag ) . name . kind  ===  SyntaxKind . Identifier  && 
445+                     ( ( node   as   JSDocTypedefTag ) . name   as   Identifier ) . isInJSDocNamespace ; 
445446                if  ( ( ! isAmbientModule ( node )  &&  ( hasExportModifier  ||  container . flags  &  NodeFlags . ExportContext ) )  ||  isJSDocTypedefInJSDocNamespace )  { 
446447                    const  exportKind  = 
447448                        ( symbolFlags  &  SymbolFlags . Value  ? SymbolFlags . ExportValue  : 0 )  | 
0 commit comments