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

fix: do not confuse booleans for alernatives in strict mode #2850

wants to merge 1 commit into from


Copy link

@Marsup Marsup commented Sep 28, 2022

Fixes #2848

@Marsup Marsup added bug Bug or defect types TypeScript type definitions labels Sep 28, 2022
@Marsup Marsup added this to the 17.6.2 milestone Sep 28, 2022
@Marsup Marsup self-assigned this Sep 28, 2022
@Marsup Marsup marked this pull request as draft September 29, 2022 07:01
@Marsup Marsup marked this pull request as ready for review September 29, 2022 07:08
Copy link

@Nargonath Nargonath left a comment

Choose a reason for hiding this comment

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


One question though for my own understanding, is the second generic parameter U used to keep the original value of T since T will be narrowed down by the conditional type so we can compare T to its original value after it's been narrowed?

Copy link
Collaborator Author

Marsup commented Sep 29, 2022

Explanation is in

Closing in favor of #2851.

@Marsup Marsup closed this Sep 29, 2022
@Marsup Marsup deleted the fix/strict-boolean branch September 29, 2022 16:04
Copy link

Thanks @Marsup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug Bug or defect types TypeScript type definitions
None yet

Successfully merging this pull request may close these issues.

Strict object schema with a boolean property expects alternative, not boolean
2 participants