Skip to content

Fix return types of NodeBuilder methods #21619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2018

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Feb 4, 2018

While working with the NodeBuilder methods that are exposed from TypeChecker, I noticed that they might return undefined, but the return type doesn't include undefined.
This changes all return types to an undefined union.

I don't know if this is the right thing to do. Shouldn't these methods throw an error if the input does not match the NodeBuilderFlags? With the current implementation you cannot tell what's wrong, you just get undefined.

In addition signatureToSignatureDeclaration can return a node with typeArguments if you pass NodeBuilderFlags.WriteTypeArgumentsOfSignature. This method now returns an IntersectionType because there's not way to extend SignatureDeclaration in another interface.
This could be changed to return an interface that extends SignatureDeclarationBase instead.

@mhegazy mhegazy merged commit c1a2adc into microsoft:master Feb 5, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 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.

2 participants