We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
type assertions order
Started at least from 3.3
Playground link with relevant code
const receiver = (x: {}) => x; const f = (x: unknown) => { if (typeof x !== 'object' || x == null) { return undefined } return receiver(x) } const f1 = (x: unknown) => { if (x == null || typeof x !== 'object') { return undefined } return receiver(x) }
Has error: Argument of type 'object | null' is not assignable to parameter of type '{}'. Type 'null' is not assignable to type '{}'.
Shouldn't have any error. Checks are equivalent.
The text was updated successfully, but these errors were encountered:
Duplicate of #28131. Used search terms: null typeof object
null typeof object
Sorry, something went wrong.
No branches or pull requests
Bug Report
π Search Terms
type assertions order
π Version & Regression Information
Started at least from 3.3
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Has error: Argument of type 'object | null' is not assignable to parameter of type '{}'. Type 'null' is not assignable to type '{}'.
π Expected behavior
Shouldn't have any error. Checks are equivalent.
The text was updated successfully, but these errors were encountered: