File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1861,12 +1861,12 @@ namespace ts {
1861
1861
}
1862
1862
1863
1863
// True if the given identifier, string literal, or number literal is the name of a declaration node
1864
- export function isDeclarationName ( name : Node ) : boolean {
1864
+ export function isDeclarationName ( name : Node , parent : Node = name . parent ) : boolean {
1865
1865
switch ( name . kind ) {
1866
1866
case SyntaxKind . Identifier :
1867
1867
case SyntaxKind . StringLiteral :
1868
1868
case SyntaxKind . NumericLiteral :
1869
- return isDeclaration ( name . parent ) && name . parent . name === name ;
1869
+ return isDeclaration ( parent ) && parent . name === name ;
1870
1870
default :
1871
1871
return false ;
1872
1872
}
@@ -4300,7 +4300,10 @@ namespace ts {
4300
4300
4301
4301
/** @internal */
4302
4302
export function isNamedDeclaration ( node : Node ) : node is NamedDeclaration & { name : DeclarationName } {
4303
- return ! ! ( node as NamedDeclaration ) . name ;
4303
+ const name = ( node as NamedDeclaration ) . name ;
4304
+ // Need to pass in parent as this is called from the binder before parent is set.
4305
+ Debug . assert ( ! name || isDeclaration ( node ) && node . name === name , "A 'name' property should always be a DeclarationName." ) ;
4306
+ return ! ! name ;
4304
4307
}
4305
4308
4306
4309
export function getNameOfDeclaration ( declaration : Declaration | Expression ) : DeclarationName | undefined {
You can’t perform that action at this time.
0 commit comments