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

setHas and arrayIncludes are unsafe #59

Open
russelldavis opened this issue Feb 21, 2024 · 1 comment
Open

setHas and arrayIncludes are unsafe #59

russelldavis opened this issue Feb 21, 2024 · 1 comment

Comments

@russelldavis
Copy link

russelldavis commented Feb 21, 2024

Because type predicates also narrow in the false case, when setHas or arrayIncludes return false, you can end up with incorrect types. More details and examples at mattpocock/ts-reset#125 (comment)

cc @tychenjiajun @younho9

@russelldavis russelldavis changed the title setHas is unsafe setHas and arrayIncludes are unsafe Mar 23, 2024
@russelldavis
Copy link
Author

Edited to add that arrayIncludes is unsafe for the same reason.

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

No branches or pull requests

1 participant