[FER] Type guard on left-hand-side of operator in
#48149
Labels
Declined
The issue was declined as something which matches the TypeScript vision
Suggestion
An idea for TypeScript
Suggestion
Operator
in
can narrow the right-hand-side value, but it could also narrow the left-hand-side:char
is'c' | 'd'
(orstring
), but ifchar in a
is true, it should be able to narrow to'c'
.🔍 Search Terms
type guard
,narrow
,operator in
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
As shown above: narrow also left-hand-side when possible.
📃 Motivating Example
As shown above
💻 Use Cases
As shown above
The text was updated successfully, but these errors were encountered: