Skip to content
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

Add serialization of typenode for null/undefined/never as part of metadata type #13034

Merged
merged 3 commits into from
Dec 21, 2016

Conversation

sheetalkamat
Copy link
Member

@sheetalkamat sheetalkamat commented Dec 19, 2016

Fixes #12684 and #11933

@@ -1715,27 +1717,35 @@ namespace ts {
case SyntaxKind.UnionType:
{
const unionOrIntersection = <UnionOrIntersectionTypeNode>node;
let serializedUnion: Identifier;
let serializedUnion: Identifier | VoidExpression;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should make the serializeType* family strongly typed when it comes to return value. today it returns Expression

if (serializedUnion && serializedUnion.text !== serializedIndividual.text) {
serializedUnion = serializedIndividual;
}
else if (isVoidExpression(serializedIndividual)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

it could also return BinaryExpression would that be fine?

Copy link
Contributor

Choose a reason for hiding this comment

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

or ConditionalExpression

@sheetalkamat
Copy link
Member Author

@mhegazy Please take a look, I have handled "non identifier" serialized expressions with null/undefined/never in the update.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 21, 2016

@sheetalkamat does this handel #13098 as well?

@@ -1815,14 +1826,15 @@ namespace ts {
}
}

type SerializedEntityNameAsExpression = Identifier | BinaryExpression | PropertyAccessExpression;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit, can you move this next to the other type alias. possibly move both to the top of the file.

@sheetalkamat
Copy link
Member Author

@mhegazy #13098 is different. This only deals with union/intersection. Will take a look at that one separately.

@sheetalkamat sheetalkamat merged commit 4cbb50a into master Dec 21, 2016
@sheetalkamat sheetalkamat deleted the unionWithNull branch December 21, 2016 20:21
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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.

None yet

3 participants