With this code
type Identity <T extends string> = T;
type MaybeString = string | undefined;
type StringOrNever = MaybeString extends undefined ? never : Identity<MaybeString>;
The compiler complain that undefined is not assignable to type String when using MaybeString as the Identity param.
Wondering if this is related to the distributive property of conditional types, i try that
type StringOrNever = [MaybeString] extends [undefined] ? [never] : Identity<MaybeString>;
which doesn't work either.
What am i doing wrong ?