-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
π Search Terms
in:title instanceof
π Version & Regression Information
- This changed between versions 5.2 and 5.3
- This changed in commit or PR Support custom 'Symbol.hasInstance' methods when narrowing 'instanceof'Β #55052
β― Playground Link
π» Code
1 instanceof { [Symbol.hasInstance]() { return true }}π Actual behavior
Error: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter.(2358)
π Expected behavior
No errors
Additional information about the issue
For custom 'Symbol.hasInstance' methods, number instanceof obj can return true or false according to implementation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript