-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed as not planned
Closed as not planned
Copy link
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options
Description
π Search Terms
"suggestions ", "generic", "nested object"
π Version & Regression Information
- This changed between versions 4.9.5 and 5.0.4
β― Playground Link
π» Code
function fn<T extends 'foo' | 'bar'>(_: {
test: {
name: T
value: T extends 'foo' ? 'foo' : 'bar'
}
value: T extends 'foo' ? 'foo' : 'bar'
}) {}
fn({
test: {
name: 'foo',
value: '' // bar | foo
},
value: '' // only foo
})
π Actual behavior
suggests 'bar' and 'foo' for nested object
π Expected behavior
should suggest only 'bar' for nested object
Additional information about the issue
Generic type constraints do not properly narrow suggestions in nested object properties
Metadata
Metadata
Assignees
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options