Skip to content

Commit 52d830f

Browse files
author
Andy Hanson
committed
Add assertion
1 parent 4071d50 commit 52d830f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/compiler/utilities.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4300,7 +4300,9 @@ namespace ts {
43004300

43014301
/** @internal */
43024302
export function isNamedDeclaration(node: Node): node is NamedDeclaration & { name: DeclarationName } {
4303-
return !!(node as NamedDeclaration).name;
4303+
const name = (node as NamedDeclaration).name;
4304+
Debug.assert(!name || isDeclaration(node) && node.name === name, "A 'name' property should always be a DeclarationName.");
4305+
return !!name;
43044306
}
43054307

43064308
export function getNameOfDeclaration(declaration: Declaration | Expression): DeclarationName | undefined {

0 commit comments

Comments
 (0)