Skip to content

Commit 385debe

Browse files
committed
Make {create/update}TypeAliasDeclaration API consistent (closes #15918)
1 parent 5e20c1c commit 385debe

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/compiler/factory.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,19 +1502,23 @@ namespace ts {
15021502
: node;
15031503
}
15041504

1505-
export function createTypeAliasDeclaration(name: string | Identifier, typeParameters: TypeParameterDeclaration[] | undefined, type: TypeNode) {
1505+
export function createTypeAliasDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, typeParameters: TypeParameterDeclaration[] | undefined, type: TypeNode) {
15061506
const node = <TypeAliasDeclaration>createSynthesizedNode(SyntaxKind.TypeAliasDeclaration);
1507+
node.decorators = asNodeArray(decorators);
1508+
node.modifiers = asNodeArray(modifiers);
15071509
node.name = asName(name);
15081510
node.typeParameters = asNodeArray(typeParameters);
15091511
node.type = type;
15101512
return node;
15111513
}
15121514

1513-
export function updateTypeAliasDeclaration(node: TypeAliasDeclaration, name: Identifier, typeParameters: TypeParameterDeclaration[] | undefined, type: TypeNode) {
1514-
return node.name !== name
1515+
export function updateTypeAliasDeclaration(node: TypeAliasDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, typeParameters: TypeParameterDeclaration[] | undefined, type: TypeNode) {
1516+
return node.decorators !== decorators
1517+
|| node.modifiers !== modifiers
1518+
|| node.name !== name
15151519
|| node.typeParameters !== typeParameters
15161520
|| node.type !== type
1517-
? updateNode(createTypeAliasDeclaration(name, typeParameters, type), node)
1521+
? updateNode(createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type), node)
15181522
: node;
15191523
}
15201524

0 commit comments

Comments
 (0)