Narrowing with typeof
and optional chaining does not work specifically with a union containing boolean
unless wrapped in parentheses
#51700
Labels
Milestone
Bug Report
π Search Terms
typeof boolean narrow optional chaining
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The type of
wrapped
is narrowed to exclude the{value?: boolean}
case, but doesn't exclude thenull
case.π Expected behavior
The type of of
wrapped
is narrowed to both exclude the{value?: boolean}
case and also exclude thenull
case.The text was updated successfully, but these errors were encountered: