File: twiceNestedKeyofIndexInference.symbols

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (139 lines) | stat: -rw-r--r-- 7,106 bytes parent folder | download | duplicates (4)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
=== tests/cases/compiler/twiceNestedKeyofIndexInference.ts ===
type Set1<T, K1 extends keyof T> = T extends any[] ? T : Pick<T, Exclude<keyof T, K1>> & {
>Set1 : Symbol(Set1, Decl(twiceNestedKeyofIndexInference.ts, 0, 0))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12))

    [SK1 in K1]-?: Required<Pick<T, SK1>>;
>SK1 : Symbol(SK1, Decl(twiceNestedKeyofIndexInference.ts, 1, 5))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12))
>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --))
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 0, 10))
>SK1 : Symbol(SK1, Decl(twiceNestedKeyofIndexInference.ts, 1, 5))

}[K1];
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 0, 12))

type Set2<T, K1 extends keyof T, K2 extends keyof T[K1]> = T extends any[] ? T : Pick<T, Exclude<keyof T, K1>> & {
>Set2 : Symbol(Set2, Decl(twiceNestedKeyofIndexInference.ts, 2, 6))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 4, 32))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))

    [SK1 in K1]-?: Required<{
>SK1 : Symbol(SK1, Decl(twiceNestedKeyofIndexInference.ts, 5, 5))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))
>Required : Symbol(Required, Decl(lib.es5.d.ts, --, --))

        [key in K1]: Set1<T[K1], K2>;
>key : Symbol(key, Decl(twiceNestedKeyofIndexInference.ts, 6, 9))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))
>Set1 : Symbol(Set1, Decl(twiceNestedKeyofIndexInference.ts, 0, 0))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 4, 10))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))
>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 4, 32))

    }>;
}[K1];
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 4, 12))

declare function set<T, K1 extends keyof T>(source: T, path: [K1], value: T[K1]): Set1<T, K1>;
>set : Symbol(set, Decl(twiceNestedKeyofIndexInference.ts, 8, 6), Decl(twiceNestedKeyofIndexInference.ts, 10, 94))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21))
>source : Symbol(source, Decl(twiceNestedKeyofIndexInference.ts, 10, 44))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21))
>path : Symbol(path, Decl(twiceNestedKeyofIndexInference.ts, 10, 54))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23))
>value : Symbol(value, Decl(twiceNestedKeyofIndexInference.ts, 10, 66))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23))
>Set1 : Symbol(Set1, Decl(twiceNestedKeyofIndexInference.ts, 0, 0))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 10, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 10, 23))

declare function set<T, K1 extends keyof T, K2 extends keyof T[K1]>(source: T, path: [K1, K2], value: T[K1][K2]): Set2<T, K1, K2>;
>set : Symbol(set, Decl(twiceNestedKeyofIndexInference.ts, 8, 6), Decl(twiceNestedKeyofIndexInference.ts, 10, 94))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21))
>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23))
>source : Symbol(source, Decl(twiceNestedKeyofIndexInference.ts, 12, 68))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21))
>path : Symbol(path, Decl(twiceNestedKeyofIndexInference.ts, 12, 78))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23))
>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43))
>value : Symbol(value, Decl(twiceNestedKeyofIndexInference.ts, 12, 94))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23))
>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43))
>Set2 : Symbol(Set2, Decl(twiceNestedKeyofIndexInference.ts, 2, 6))
>T : Symbol(T, Decl(twiceNestedKeyofIndexInference.ts, 12, 21))
>K1 : Symbol(K1, Decl(twiceNestedKeyofIndexInference.ts, 12, 23))
>K2 : Symbol(K2, Decl(twiceNestedKeyofIndexInference.ts, 12, 43))


interface State {
>State : Symbol(State, Decl(twiceNestedKeyofIndexInference.ts, 12, 130))

    a: {
>a : Symbol(State.a, Decl(twiceNestedKeyofIndexInference.ts, 15, 17))

        b: string;
>b : Symbol(b, Decl(twiceNestedKeyofIndexInference.ts, 16, 8))

        c: number;
>c : Symbol(c, Decl(twiceNestedKeyofIndexInference.ts, 17, 18))

    };
    d: boolean;
>d : Symbol(State.d, Decl(twiceNestedKeyofIndexInference.ts, 19, 6))
}

const state: State = {
>state : Symbol(state, Decl(twiceNestedKeyofIndexInference.ts, 23, 5))
>State : Symbol(State, Decl(twiceNestedKeyofIndexInference.ts, 12, 130))

    a: {
>a : Symbol(a, Decl(twiceNestedKeyofIndexInference.ts, 23, 22))

        b: "",
>b : Symbol(b, Decl(twiceNestedKeyofIndexInference.ts, 24, 8))

        c: 0,
>c : Symbol(c, Decl(twiceNestedKeyofIndexInference.ts, 25, 14))

    },
    d: false,
>d : Symbol(d, Decl(twiceNestedKeyofIndexInference.ts, 27, 6))

};

const newState: State = set(state, ["a", 'b'], 'why'); // shouldn't be an error
>newState : Symbol(newState, Decl(twiceNestedKeyofIndexInference.ts, 31, 5))
>State : Symbol(State, Decl(twiceNestedKeyofIndexInference.ts, 12, 130))
>set : Symbol(set, Decl(twiceNestedKeyofIndexInference.ts, 8, 6), Decl(twiceNestedKeyofIndexInference.ts, 10, 94))
>state : Symbol(state, Decl(twiceNestedKeyofIndexInference.ts, 23, 5))