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
Narrowing through indirect references occurs only when the conditional expression or discriminant property access is declared in a const variable declaration with no type annotation, and the reference being narrowed is a const variable, a readonly property, or a parameter for which there are no assignments in the function body.
So you have to mark the property value readonly to make it work:
Bug Report
π Search Terms
ternary operator, props object, object is possibly null
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
example1
throws an error because TS thinksprops.value
might be null when checking its length.π Expected behavior
There should be no error, like in the other two functions.
The text was updated successfully, but these errors were encountered: