You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As specified here, https://tc39.es/ecma262/#sec-instanceofoperator, it should be sufficient for an object to define a function for the Symbol.hasInstance well-known symbol in order to be used as the right-hand side of the instanceof operator.
It seems like this was intended to be implemented based on these comments: #12728 (comment)
but for whatever reason that didn't happen it in the PR
Search Terms: Symbol.hasInstance
Code
({})instanceof{[Symbol.hasInstance]: ()=>true}// Running this in the browser evaluates to `true`
Expected behavior:
No type-errors
Actual behavior:
({})instanceof{[Symbol.hasInstance]: ()=>true}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!errorTS2359: Theright-handsideofan 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type.