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
Wrong local variable type when assigned in lambda.Β #61313
The type of error is inferred as null in line 11 and unknown in line 12. This is wrong because there is a potential assignment to error` in the local lambda.
π Expected behavior
The type of error should be Error|null after the onError call as there is a potential assignment happening in the callback. Its understandable if the analyzer cannot widen the type if the passed callback is again some other function or method but for local lamdbas it could be treated like a "conditional" which might be met. e.g. in the following example error is widened to Error|null
Activity
MartinJohns commentedon Feb 27, 2025
Duplicate of #9998. There's even a dedicated issue type for this: https://github.com/microsoft/TypeScript/blob/main/.github/ISSUE_TEMPLATE/types-not-correct-in-with-callback.md?plain=1
Danielku15 commentedon Feb 27, 2025
Sorry, I have totally missed this. πββ Textual searching is hardly possible anymore in this repository π’