Skip to content

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

Merged
sheetalkamat merged 3 commits into
masterfrom
unionWithNull
Dec 21, 2016
Merged

Add serialization of typenode for null/undefined/never as part of metadata type#13034
sheetalkamat merged 3 commits into
masterfrom
unionWithNull

Conversation

@sheetalkamat
Copy link
Copy Markdown
Member

@sheetalkamat sheetalkamat commented Dec 19, 2016

Fixes #12684 and #11933

Comment thread src/compiler/transformers/ts.ts Outdated
{
const unionOrIntersection = <UnionOrIntersectionTypeNode>node;
let serializedUnion: Identifier;
let serializedUnion: Identifier | VoidExpression;
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 should make the serializeType* family strongly typed when it comes to return value. today it returns Expression

Comment thread src/compiler/transformers/ts.ts Outdated
if (serializedUnion && serializedUnion.text !== serializedIndividual.text) {
serializedUnion = serializedIndividual;
}
else if (isVoidExpression(serializedIndividual)) {
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.

it could also return BinaryExpression would that be fine?

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.

or ConditionalExpression

@sheetalkamat
Copy link
Copy Markdown
Member Author

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

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Dec 21, 2016

@sheetalkamat does this handel #13098 as well?

Comment thread src/compiler/transformers/ts.ts Outdated
}
}

type SerializedEntityNameAsExpression = Identifier | BinaryExpression | PropertyAccessExpression;
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.

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

@sheetalkamat
Copy link
Copy Markdown
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.

3 participants