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
Object is possibly 'undefined' / undefined key / nullable key
🕗 Version & Regression Information
This is the behavior in every major version I tried, from 3 to 5, and I reviewed the FAQ for entries matching "undefined", "object", "record", and "property".
Bug Report
🔎 Search Terms
Object is possibly 'undefined' / undefined key / nullable key
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code (Nightly)
💻 Code
🙁 Actual behavior
It fails to compile with an error:
Object is possibly 'undefined'.(2532)
.It should compile because:
randomKey
is truthy (I triedif (randomKey !== undefined) {
but got the same error)food[randomKey]
is truthy (I triedif (food[randomKey] !== undefined) {
but got the same error)🙂 Expected behavior
It should compile without errors.
The text was updated successfully, but these errors were encountered: