Closed
Description
The below code:
class M {
__m: any;
}
class C {
__c: any;
}
type D = typeof M | typeof C;
interface R {
[i: string]: D;
}
function f1(p: D) {
}
interface P {
p1: string;
p2: string;
}
function f2<K extends keyof P>(p: K) {
let r: R = {};
if (p in r) {
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
?