Skip to content

Filter primitives from union when checking for mismatched excess props if nonprimitive type is present #31708

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 2 commits into from
Jun 13, 2019

Conversation

weswigham
Copy link
Member

Fixes #31668

@@ -12869,6 +12869,16 @@ namespace ts {
return bestMatch;
}

function filterPrimitivesIfContainsNonPrimitive(type: UnionType) {
if (some(type.types, t => !!(t.flags & TypeFlags.NonPrimitive))) {
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure there's a someTypeHasFlags or something

@weswigham weswigham force-pushed the discriminate-objects-only branch from a1c5b5d to b235998 Compare June 11, 2019 23:56
@weswigham
Copy link
Member Author

@typescript-bot run dt
@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 11, 2019

Heya @weswigham, I've started to run the extended test suite on this PR at b235998. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 11, 2019

Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at b235998. You can monitor the build here. It should now contribute to this PR's status checks.

@weswigham
Copy link
Member Author

ping @DanielRosenwasser @sandersn

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Seems a little ad-hoc but all of excess property checking is ad-hoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apparent properties in union of primitive and object causes incorrect error
4 participants