-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
π Search Terms
instanceof Object
in
π Version & Regression Information
- This changed between versions 4.9.0-dev.20220919 and 4.9.0-dev.20220920
β― Playground Link
π» Code
export function isHTMLTable(table: unknown): boolean {
return !!table && table instanceof Object && 'html' in table;
}
π Actual behavior
Error: Type '{}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator
π Expected behavior
Should type check
Notes
Seems to be introduced by #50666 which correctly introduces an error if in
is used on non objects. The issue is that it does not handle testing for objects with instanceof Object
wegry
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue