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

Deal with Symbol.hasInstance for instanceof operator #2537

Open
Dionysusnu opened this issue Nov 6, 2023 · 0 comments
Open

Deal with Symbol.hasInstance for instanceof operator #2537

Dionysusnu opened this issue Nov 6, 2023 · 0 comments
Milestone

Comments

@Dionysusnu
Copy link
Contributor

Dionysusnu commented Nov 6, 2023

Currently, classes can specify custom instanceof behaviour by having a static method called instanceof.
https://devblogs.microsoft.com/typescript/announcing-typescript-5-3-rc/#instanceof-narrowing-through-symbol-hasinstance
Now that TypeScript will narrow types based on the Symbol.hasInstance method, it'd be useful to convert that, either additionally, or replacing the current instanceof behaviour.

This might need more general design about how to deal with Symbol and its properties, therefore related to #1826.

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

2 participants