The below code:
classM{__m: any;}classC{__c: any;}typeD=typeofM|typeofC;interfaceR{[i: string]: D;}functionf1(p: D){}interfaceP{p1: string;p2: string;}functionf2<KextendskeyofP>(p: K){letr: R={};if(pinr){f1(r[p]);// Error `R[K]` is not assignable to `D`}}Gives me the error R[K] is not assignable to D.
Though isn't R[K] equal to D?
The below code:
Gives me the error
R[K]is not assignable toD.Though isn't
R[K]equal toD?