I dont know what's wrong with my typing :
type t_firstChar<T extends string > = T extends `${infer A}${infer R}` ? A : T
let checkExtUnionFirstChar : t_firstChar<"Test1" > extends t_firstChar<"Test1" | "Function" > ? true :false //true , expected true
let checkExtUnionJson_1 : {firstC:t_firstChar<"Test1">} extends {firstC:(t_firstChar<"Test1">|t_firstChar<"Function">)} ? true :false //true , expected true
let checkExtUnionJson_2 : {firstC:t_firstChar<"Test1">} extends {firstC:t_firstChar<"Test1">}|{firstC:t_firstChar<"Function">} ? true :false //true , expected true
type IFirstChar<T extends string > = {firstC:t_firstChar<T>}
let checkExtUnionInterface : IFirstChar<"Test1" > extends IFirstChar<"Test1" | "Function" > ? true :false // false , expected true
I expect that typeof checkExtUnionInterface
is true
but it's false
.
Can anyone explain what I'm missing please?