Here's an example, I would like to make the expect-error directives pass. I recall seeing a solution to this in the past, but can't remember now.
interface Input<T extends 'a' | 'b' = 'a' | 'b'> {
t: T
u: T extends 'a' ? (1|2) : (3|4)
}
const create = <$Input extends Input>(x: $Input) => x
// create({ t: 'a', u: /* should be 1|2 <- struggling to get this working */ })
create({t:'a',u:1})
create({t:'a',u:2})
// @ts-expect-error
create({t:'a',u:3})
// @ts-expect-error
create({t:'a',u:4})