File: typeUsedAsTypeLiteralIndex.types

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (61 lines) | stat: -rw-r--r-- 830 bytes parent folder | download
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 : K

type T = {
>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 : T1

    [K1]: number;
>[K1] : number
>K1 : unique symbol
}

type K2 = "x" | "y";
>K2 : K2

type T2 = {
>T2 : T2

    [K2]: number;  // Did you mean to use 'K in K2'?
>[K2] : number
>K2 : any
}

type K3 = number | string;
>K3 : K

type T3 = {
>T3 : T3

    [K3]: number; // Did you mean to use 'K in K3'?
>[K3] : number
>K3 : any
}

type K4 = number | string;
>K4 : K

type T4 = {
>T4 : T4

    [K4]: number;
>[K4] : number
>K4 : any

    k4: string;
>k4 : string
}