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? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Object is possibly 'null'
undefined
This is the behavior in every version I tried, and I reviewed the FAQ for entries about unexpected warnings about possible 'null's and 'undefined's.
I tried versions 3.3.3333 and 4.3.0-beta, though I did not try any in the middle.
3.3.3333
4.3.0-beta
Playground link with relevant code
const refs: {current: {value: number} | null}[] = [{current: { value: 2}}]; if (refs.every((ref) => ref.current != null)) { refs[0].current.value = 1; }
"Object is possibly 'null'" warning on refs[0].current
refs[0].current
No warnings, as they cannot be null since the refs.every(...) is checking that.
refs.every(...)
The text was updated successfully, but these errors were encountered:
Similar to #16069, maybe #18562.
One of the problems with this is that if something mutates the underlying array, your assumptions would be invalidated.
Sorry, something went wrong.
I think we can call it a duplicate of / encompassed by #38390
Yes we can!
No branches or pull requests
Bug Report
🔎 Search Terms
Object is possibly 'null'
undefined
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about unexpected warnings about possible 'null's and 'undefined's.
I tried versions
3.3.3333
and4.3.0-beta
, though I did not try any in the middle.⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
"Object is possibly 'null'" warning on
refs[0].current
🙂 Expected behavior
No warnings, as they cannot be null since the
refs.every(...)
is checking that.The text was updated successfully, but these errors were encountered: