Skip to content

elaborate check before converting fresh literal type to regular #12595

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
Dec 12, 2016

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Dec 1, 2016

fixes #12584

@vladima
Copy link
Contributor Author

vladima commented Dec 1, 2016

@mhegazy can you please take a look? Once this one is ok to go I'll port it into release-2.1.

// at this point we know that this is union or intersection type possibly with nullable constituents.
// check if we still will have compound type if we ignore nullable components.
let seenNonNullable = false;
for (const t of (<UnionOrIntersectionType>type).types) {
Copy link
Contributor

@mhegazy mhegazy Dec 12, 2016

Choose a reason for hiding this comment

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

is not this just maybeTypeOfKind(type, ~TypeFlags.Nullable)?

Copy link
Contributor Author

@vladima vladima Dec 12, 2016

Choose a reason for hiding this comment

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

no, since AFAIR maybeTypeOfKind(type, ~TypeFlags.Nullable) will return true for union or intersection type that consist of non-nullable type and nullable type and this is not what we want.

@vladima vladima merged commit d050673 into master Dec 12, 2016
@vladima vladima deleted the vladima/12584 branch December 12, 2016 20:37
@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.

Code used to work but doesn't in nightly
3 participants