Closed
Description
There's a Stack Overflow question that seems to be related to this PR:
interface Baz {
foo: { a: number };
}
const createDefaultExample = <K extends keyof Baz>(x: K): Baz[K] & { x: K; } => {
return { a: 0, x }; // okay in TS4.7, error in TS4.8
}
Looks like the fix for #49520 might have broken this. Is it a bug and should this be filed as such? Or is it intended in some way?
EDIT: Looks like the above was fixed by #50261 but this one persists:
type Foo<K> = K extends unknown ? { a: number } : unknown
const createDefaultExample = <K,>(x: K): Foo<K> & { x: K; } => {
return { a: 1, x: x }; // okay in TS 4.7.4, error in TS 4.8.2
}
Same question, I guess... bug? Not bug? New issue?
Originally posted by @jcalz in #49503 (comment)