Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88f9a97

Browse filesBrowse files
authored
Merge pull request microsoft#15500 from phated/interface-declaration
Add {create|update}InterfaceDeclaration methods
2 parents 20bba9c + a6f7f5e commit 88f9a97
Copy full SHA for 88f9a97

1 file changed

+22Lines changed: 22 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/factory.ts‎

Copy file name to clipboardExpand all lines: src/compiler/factory.ts
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,28 @@ namespace ts {
14401440
: node;
14411441
}
14421442

1443+
export function createInterfaceDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[] | undefined, members: TypeElement[]) {
1444+
const node = <InterfaceDeclaration>createSynthesizedNode(SyntaxKind.InterfaceDeclaration);
1445+
node.decorators = asNodeArray(decorators);
1446+
node.modifiers = asNodeArray(modifiers);
1447+
node.name = asName(name);
1448+
node.typeParameters = asNodeArray(typeParameters);
1449+
node.heritageClauses = asNodeArray(heritageClauses);
1450+
node.members = createNodeArray(members);
1451+
return node;
1452+
}
1453+
1454+
export function updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[] | undefined, members: TypeElement[]) {
1455+
return node.decorators !== decorators
1456+
|| node.modifiers !== modifiers
1457+
|| node.name !== name
1458+
|| node.typeParameters !== typeParameters
1459+
|| node.heritageClauses !== heritageClauses
1460+
|| node.members !== members
1461+
? updateNode(createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node)
1462+
: node;
1463+
}
1464+
14431465
export function createEnumDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier, members: EnumMember[]) {
14441466
const node = <EnumDeclaration>createSynthesizedNode(SyntaxKind.EnumDeclaration);
14451467
node.decorators = asNodeArray(decorators);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.