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
typeof, guard, early return, object, keys, null
Playground link with relevant code
function doSomething() { const myThing = Math.random() > 0.5 ? { foo: 'bar' } : null; if (!myThing) return; const okayThing: { foo: typeof myThing.foo } = { foo: 'bar' } const notOkayThing: { [key: string]: typeof myThing.foo } = { foo: 'bar' } // Error: Object is possibly 'null' }
notOkayThing errors with Object is possibly 'null'.
notOkayThing
Object is possibly 'null'
Types for values in okayThing and notOkayThing should be equivalent.
okayThing
The text was updated successfully, but these errors were encountered:
hi, Can i try to solve this issue?
Sorry, something went wrong.
@ritikBhandari are you working on this issue ? If not I would like to try to resolve the issue.
@Blopaa I'm working on another issue. You can try it! :)
Successfully merging a pull request may close this issue.
Bug Report
π Search Terms
typeof, guard, early return, object, keys, null
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
notOkayThing
errors withObject is possibly 'null'
.π Expected behavior
Types for values in
okayThing
andnotOkayThing
should be equivalent.The text was updated successfully, but these errors were encountered: