1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
=== tests/cases/compiler/typeUsedAsTypeLiteralIndex.ts ===
type K = number | string;
>K : string | number
type T = {
>T : {}
[K]: number; // Did you mean to use 'P in K'?
>[K] : number
>K : any
}
const K1 = Symbol();
>K1 : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
type T1 = {
>T1 : { [K1]: number; }
[K1]: number;
>[K1] : number
>K1 : unique symbol
}
type K2 = "x" | "y";
>K2 : "x" | "y"
type T2 = {
>T2 : {}
[K2]: number; // Did you mean to use 'K in K2'?
>[K2] : number
>K2 : any
}
type K3 = number | string;
>K3 : string | number
type T3 = {
>T3 : {}
[K3]: number; // Did you mean to use 'K in K3'?
>[K3] : number
>K3 : any
}
type K4 = number | string;
>K4 : string | number
type T4 = {
>T4 : { k4: string; }
[K4]: number;
>[K4] : number
>K4 : any
k4: string;
>k4 : string
}
|