I have a conditional type where both sides of the condition are identical:
type Wut<T> = T extends number ? string | T : string | T
(This is not very useful. I'm just trying to understand what's going on.)
I can use the type as expected:
const huh1: Wut<number> = 'huh' // OK
const huh2: Wut<object> = 'huh' // OK
const huh3: Wut<string> = 'huh' // OK
const huh4: Wut<number> = 22 // OK
... until I try to inherit from other generics:
function hmmm<N extends number, S extends string>() {
const huh1: Wut<N> = 'huh' // <- Type 'string' is not assignable to 'Wut<T>'
const huh2: Wut<N> = 22 // <- Type 'number' is not assignable to 'Wut<T>'
const huh3: Wut<S> = 'huh' // <- Type 'string' is not assignable to 'Wut<T>'
}
What's wrong with my conditional type here?