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
{{ message }}
Repository navigation
"Property does not exist on type 'never'" with optional chaining #58733
Bruce Pascoe (@fatcerberus) maybe it does, but not the case in my code. I have some code that fetches project data and assigns the data to the project variable, but I'm still getting this error
I couldn't follow that whole snippet but basically TS can't follow the control flow there because it involves a lot of callbacks and closures. See #9998. Not sure if this would be fixed by #58729 (but probably not)
Activity
fatcerberus commentedon Jun 1, 2024
Variables are narrowed on assignment/initialization. TS knows
projectis alwaysnullhere.JorensM commentedon Jun 1, 2024
Bruce Pascoe (@fatcerberus) maybe it does, but not the case in my code. I have some code that fetches project data and assigns the data to the
projectvariable, but I'm still getting this errorJorensM commentedon Jun 1, 2024
Here is the full code for the page:
fatcerberus commentedon Jun 1, 2024
I couldn't follow that whole snippet but basically TS can't follow the control flow there because it involves a lot of callbacks and closures. See #9998. Not sure if this would be fixed by #58729 (but probably not)
Workaround:
JorensM commentedon Jun 1, 2024
Bruce Pascoe (@fatcerberus) Ok, thank you very much!
typescript-bot commentedon Jun 10, 2024
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.