#Conditional type generic doesn't work

2 messages · Page 1 of 1 (latest)

burnt mulchBOT
#
karbal#6538

Preview:ts export interface Typ { val: string } export function fn<X extends Typ = Typ>() { const val_1: "val" extends keyof Typ ? string : number = "......." //! Type 'string' is not assignable to type '"val" extends keyof X ? string : number'.(2322) const val_2: "val" extends keyof X ? string : number = "...... ...

remote solstice
#

yeah, typescript doesn't try to inspect generic parameters at all