Closed as not planned
Closed as not planned
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