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

Add {create|update}InterfaceDeclaration methods#15500

Merged
rbuckton merged 2 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
phated:interface-declarationphated/TypeScript:interface-declarationCopy head branch name to clipboard
May 1, 2017
Merged

Add {create|update}InterfaceDeclaration methods#15500
rbuckton merged 2 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
phated:interface-declarationphated/TypeScript:interface-declarationCopy head branch name to clipboard

Conversation

@phated

@phated phated commented May 1, 2017

Copy link
Copy Markdown
Contributor

Fixes #15497

@msftclas

msftclas commented May 1, 2017

Copy link
Copy Markdown

@phated,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas

msftclas commented May 1, 2017

Copy link
Copy Markdown

@phated, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

Comment thread src/compiler/factory.ts

export function createInterfaceDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: TypeElement[]) {
const node = <InterfaceDeclaration>createSynthesizedNode(SyntaxKind.InterfaceDeclaration);
node.decorators = asNodeArray(decorators);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interfaces don't have decorators AFAIK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that it didn't give me a type like some of the other members.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We parse decorators for interfaces but only to report errors currently. We do plan to support "ambient" decorators (compiler only) at some point in the future, so it is better to have them included in the signature.

@mhegazy mhegazy requested a review from rbuckton May 1, 2017 18:31
Comment thread src/compiler/factory.ts Outdated
: node;
}

export function createInterfaceDeclaration(decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: string | Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: TypeElement[]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An interface must always have a name, so name should be string | Identifier. undefined is not permitted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heritageClauses can be undefined, so the type should be HeritageClause[] | undefined.

Comment thread src/compiler/factory.ts Outdated
return node;
}

export function updateInterfaceDeclaration(node: InterfaceDeclaration, decorators: Decorator[] | undefined, modifiers: Modifier[] | undefined, name: Identifier | undefined, typeParameters: TypeParameterDeclaration[] | undefined, heritageClauses: HeritageClause[], members: TypeElement[]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An interface must always have a name, so name should be Identifier here. undefined is not permitted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heritageClauses can be undefined, so the type should be HeritageClause[] | undefined.

@phated

phated commented May 1, 2017

Copy link
Copy Markdown
Contributor Author

Updated

@rbuckton rbuckton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for the contribution.

@rbuckton rbuckton merged commit 88f9a97 into microsoft:master May 1, 2017
@rbuckton rbuckton mentioned this pull request May 2, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

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