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
Right now, only the last instruction fails in TS with the error Object is possibly 'null' :
Object is possibly 'null'
declare const value: null | { x: number }; const foo = value && value.x; const bar = !!value && value.x; const baz = Boolean(value) && value.x;
Playground
Since it's strictly equivalent to the instruction just above, I suggest making the same type assumptions.
Boolean, function, inference, assumption, assertion
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered:
Duplicate of #16655.
Sorry, something went wrong.
No branches or pull requests
Suggestion
Right now, only the last instruction fails in TS with the error
Object is possibly 'null'
:Playground
Since it's strictly equivalent to the instruction just above, I suggest making the same type assumptions.
🔍 Search Terms
Boolean, function, inference, assumption, assertion
✅ Viability Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: