-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
Description
π Search Terms
T to null
π Version & Regression Information
- This is a type narrowing issue
- This is the behavior in every version I tried
β― Playground Link
π» Code
function isNull<T>(value: T) {
if (value === null) {
value // T, should be null
}
return value === null;
}
π Actual behavior
value is T inside the if block of value === null (explicit comparison)
π Expected behavior
value should be of type null inside the if block of value === null
Additional information about the issue
No response
danvk
Metadata
Metadata
Assignees
Labels
Possible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases