|
1 | 1 | tests/cases/compiler/destructuringUnspreadableIntoRest.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
2 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(14,15): error TS2339: Property 'bar' does not exist on type 'Omit<this, "bar" | "func">'. |
3 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(15,15): error TS2339: Property 'bar' does not exist on type '{ foo: string; }'. |
4 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(16,15): error TS2339: Property 'bar' does not exist on type 'Omit<this, "foo" | "bar" | "func">'. |
5 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(17,15): error TS2339: Property 'bar' does not exist on type '{}'. |
6 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(19,15): error TS2339: Property 'func' does not exist on type 'Omit<this, "bar" | "func">'. |
7 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(20,15): error TS2339: Property 'func' does not exist on type '{ foo: string; }'. |
8 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(21,15): error TS2339: Property 'func' does not exist on type 'Omit<this, "foo" | "bar" | "func">'. |
9 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(22,15): error TS2339: Property 'func' does not exist on type '{}'. |
10 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(32,11): error TS2339: Property 'bar' does not exist on type 'Omit<T, "bar" | "func">'. |
11 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(33,11): error TS2339: Property 'bar' does not exist on type '{ foo: string; }'. |
12 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(34,11): error TS2339: Property 'bar' does not exist on type 'Omit<T, "foo" | "bar" | "func">'. |
13 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(35,11): error TS2339: Property 'bar' does not exist on type '{}'. |
14 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(37,11): error TS2339: Property 'func' does not exist on type 'Omit<T, "bar" | "func">'. |
15 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(38,11): error TS2339: Property 'func' does not exist on type '{ foo: string; }'. |
16 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(39,11): error TS2339: Property 'func' does not exist on type 'Omit<T, "foo" | "bar" | "func">'. |
17 |
| -tests/cases/compiler/destructuringUnspreadableIntoRest.ts(40,11): error TS2339: Property 'func' does not exist on type '{}'. |
| 2 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(8,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. |
| 3 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(16,15): error TS2339: Property 'getter' does not exist on type 'Omit<this, "getter" | "setter" | "method">'. |
| 4 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(17,15): error TS2339: Property 'getter' does not exist on type '{ normal: string; }'. |
| 5 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(18,15): error TS2339: Property 'getter' does not exist on type 'Omit<this, "normal" | "getter" | "setter" | "method">'. |
| 6 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(19,15): error TS2339: Property 'getter' does not exist on type '{}'. |
| 7 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(21,15): error TS2339: Property 'setter' does not exist on type 'Omit<this, "getter" | "setter" | "method">'. |
| 8 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(22,15): error TS2339: Property 'setter' does not exist on type '{ normal: string; }'. |
| 9 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(23,15): error TS2339: Property 'setter' does not exist on type 'Omit<this, "normal" | "getter" | "setter" | "method">'. |
| 10 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(24,15): error TS2339: Property 'setter' does not exist on type '{}'. |
| 11 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(26,15): error TS2339: Property 'method' does not exist on type 'Omit<this, "getter" | "setter" | "method">'. |
| 12 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(27,15): error TS2339: Property 'method' does not exist on type '{ normal: string; }'. |
| 13 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(28,15): error TS2339: Property 'method' does not exist on type 'Omit<this, "normal" | "getter" | "setter" | "method">'. |
| 14 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(29,15): error TS2339: Property 'method' does not exist on type '{}'. |
| 15 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(39,11): error TS2339: Property 'getter' does not exist on type 'Omit<T, "getter" | "setter" | "method">'. |
| 16 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(40,11): error TS2339: Property 'getter' does not exist on type '{ normal: string; }'. |
| 17 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(41,11): error TS2339: Property 'getter' does not exist on type 'Omit<T, "normal" | "getter" | "setter" | "method">'. |
| 18 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(42,11): error TS2339: Property 'getter' does not exist on type '{}'. |
| 19 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(44,11): error TS2339: Property 'setter' does not exist on type 'Omit<T, "getter" | "setter" | "method">'. |
| 20 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(45,11): error TS2339: Property 'setter' does not exist on type '{ normal: string; }'. |
| 21 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(46,11): error TS2339: Property 'setter' does not exist on type 'Omit<T, "normal" | "getter" | "setter" | "method">'. |
| 22 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(47,11): error TS2339: Property 'setter' does not exist on type '{}'. |
| 23 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(49,11): error TS2339: Property 'method' does not exist on type 'Omit<T, "getter" | "setter" | "method">'. |
| 24 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(50,11): error TS2339: Property 'method' does not exist on type '{ normal: string; }'. |
| 25 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(51,11): error TS2339: Property 'method' does not exist on type 'Omit<T, "normal" | "getter" | "setter" | "method">'. |
| 26 | +tests/cases/compiler/destructuringUnspreadableIntoRest.ts(52,11): error TS2339: Property 'method' does not exist on type '{}'. |
18 | 27 |
|
19 | 28 |
|
20 |
| -==== tests/cases/compiler/destructuringUnspreadableIntoRest.ts (17 errors) ==== |
| 29 | +==== tests/cases/compiler/destructuringUnspreadableIntoRest.ts (26 errors) ==== |
21 | 30 | class A {
|
22 |
| - constructor(public foo: string) {} |
| 31 | + constructor(public normal: string) {} |
23 | 32 |
|
24 |
| - get bar(): number { |
25 |
| - ~~~ |
| 33 | + get getter(): number { |
| 34 | + ~~~~~~ |
26 | 35 | !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
27 | 36 | return 1;
|
28 | 37 | }
|
29 | 38 |
|
30 |
| - func() { |
| 39 | + set setter(_v: number) {} |
| 40 | + ~~~~~~ |
| 41 | +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. |
| 42 | + |
| 43 | + method() { |
31 | 44 | const { ...rest1 } = this;
|
32 | 45 | const { ...rest2 } = this as A;
|
33 |
| - const { foo: _f1, ...rest3 } = this; |
34 |
| - const { foo: _f2, ...rest4 } = this as A; |
| 46 | + const { normal: _1, ...rest3 } = this; |
| 47 | + const { normal: _2, ...rest4 } = this as A; |
35 | 48 |
|
36 |
| - rest1.bar; |
37 |
| - ~~~ |
38 |
| -!!! error TS2339: Property 'bar' does not exist on type 'Omit<this, "bar" | "func">'. |
39 |
| - rest2.bar; |
40 |
| - ~~~ |
41 |
| -!!! error TS2339: Property 'bar' does not exist on type '{ foo: string; }'. |
42 |
| - rest3.bar; |
43 |
| - ~~~ |
44 |
| -!!! error TS2339: Property 'bar' does not exist on type 'Omit<this, "foo" | "bar" | "func">'. |
45 |
| - rest4.bar; |
46 |
| - ~~~ |
47 |
| -!!! error TS2339: Property 'bar' does not exist on type '{}'. |
| 49 | + rest1.getter; |
| 50 | + ~~~~~~ |
| 51 | +!!! error TS2339: Property 'getter' does not exist on type 'Omit<this, "getter" | "setter" | "method">'. |
| 52 | + rest2.getter; |
| 53 | + ~~~~~~ |
| 54 | +!!! error TS2339: Property 'getter' does not exist on type '{ normal: string; }'. |
| 55 | + rest3.getter; |
| 56 | + ~~~~~~ |
| 57 | +!!! error TS2339: Property 'getter' does not exist on type 'Omit<this, "normal" | "getter" | "setter" | "method">'. |
| 58 | + rest4.getter; |
| 59 | + ~~~~~~ |
| 60 | +!!! error TS2339: Property 'getter' does not exist on type '{}'. |
48 | 61 |
|
49 |
| - rest1.func; |
50 |
| - ~~~~ |
51 |
| -!!! error TS2339: Property 'func' does not exist on type 'Omit<this, "bar" | "func">'. |
52 |
| - rest2.func; |
53 |
| - ~~~~ |
54 |
| -!!! error TS2339: Property 'func' does not exist on type '{ foo: string; }'. |
55 |
| - rest3.func; |
56 |
| - ~~~~ |
57 |
| -!!! error TS2339: Property 'func' does not exist on type 'Omit<this, "foo" | "bar" | "func">'. |
58 |
| - rest4.func; |
59 |
| - ~~~~ |
60 |
| -!!! error TS2339: Property 'func' does not exist on type '{}'. |
| 62 | + rest1.setter; |
| 63 | + ~~~~~~ |
| 64 | +!!! error TS2339: Property 'setter' does not exist on type 'Omit<this, "getter" | "setter" | "method">'. |
| 65 | + rest2.setter; |
| 66 | + ~~~~~~ |
| 67 | +!!! error TS2339: Property 'setter' does not exist on type '{ normal: string; }'. |
| 68 | + rest3.setter; |
| 69 | + ~~~~~~ |
| 70 | +!!! error TS2339: Property 'setter' does not exist on type 'Omit<this, "normal" | "getter" | "setter" | "method">'. |
| 71 | + rest4.setter; |
| 72 | + ~~~~~~ |
| 73 | +!!! error TS2339: Property 'setter' does not exist on type '{}'. |
| 74 | + |
| 75 | + rest1.method; |
| 76 | + ~~~~~~ |
| 77 | +!!! error TS2339: Property 'method' does not exist on type 'Omit<this, "getter" | "setter" | "method">'. |
| 78 | + rest2.method; |
| 79 | + ~~~~~~ |
| 80 | +!!! error TS2339: Property 'method' does not exist on type '{ normal: string; }'. |
| 81 | + rest3.method; |
| 82 | + ~~~~~~ |
| 83 | +!!! error TS2339: Property 'method' does not exist on type 'Omit<this, "normal" | "getter" | "setter" | "method">'. |
| 84 | + rest4.method; |
| 85 | + ~~~~~~ |
| 86 | +!!! error TS2339: Property 'method' does not exist on type '{}'. |
61 | 87 | }
|
62 | 88 | }
|
63 | 89 |
|
64 | 90 | function destructure<T extends A>(x: T) {
|
65 | 91 | const { ...rest1 } = x;
|
66 | 92 | const { ...rest2 } = x as A;
|
67 |
| - const { foo: _f1, ...rest3 } = x; |
68 |
| - const { foo: _f2, ...rest4 } = x as A; |
| 93 | + const { normal: _1, ...rest3 } = x; |
| 94 | + const { normal: _2, ...rest4 } = x as A; |
| 95 | + |
| 96 | + rest1.getter; |
| 97 | + ~~~~~~ |
| 98 | +!!! error TS2339: Property 'getter' does not exist on type 'Omit<T, "getter" | "setter" | "method">'. |
| 99 | + rest2.getter; |
| 100 | + ~~~~~~ |
| 101 | +!!! error TS2339: Property 'getter' does not exist on type '{ normal: string; }'. |
| 102 | + rest3.getter; |
| 103 | + ~~~~~~ |
| 104 | +!!! error TS2339: Property 'getter' does not exist on type 'Omit<T, "normal" | "getter" | "setter" | "method">'. |
| 105 | + rest4.getter; |
| 106 | + ~~~~~~ |
| 107 | +!!! error TS2339: Property 'getter' does not exist on type '{}'. |
69 | 108 |
|
70 |
| - rest1.bar; |
71 |
| - ~~~ |
72 |
| -!!! error TS2339: Property 'bar' does not exist on type 'Omit<T, "bar" | "func">'. |
73 |
| - rest2.bar; |
74 |
| - ~~~ |
75 |
| -!!! error TS2339: Property 'bar' does not exist on type '{ foo: string; }'. |
76 |
| - rest3.bar; |
77 |
| - ~~~ |
78 |
| -!!! error TS2339: Property 'bar' does not exist on type 'Omit<T, "foo" | "bar" | "func">'. |
79 |
| - rest4.bar; |
80 |
| - ~~~ |
81 |
| -!!! error TS2339: Property 'bar' does not exist on type '{}'. |
| 109 | + rest1.setter; |
| 110 | + ~~~~~~ |
| 111 | +!!! error TS2339: Property 'setter' does not exist on type 'Omit<T, "getter" | "setter" | "method">'. |
| 112 | + rest2.setter; |
| 113 | + ~~~~~~ |
| 114 | +!!! error TS2339: Property 'setter' does not exist on type '{ normal: string; }'. |
| 115 | + rest3.setter; |
| 116 | + ~~~~~~ |
| 117 | +!!! error TS2339: Property 'setter' does not exist on type 'Omit<T, "normal" | "getter" | "setter" | "method">'. |
| 118 | + rest4.setter; |
| 119 | + ~~~~~~ |
| 120 | +!!! error TS2339: Property 'setter' does not exist on type '{}'. |
82 | 121 |
|
83 |
| - rest1.func; |
84 |
| - ~~~~ |
85 |
| -!!! error TS2339: Property 'func' does not exist on type 'Omit<T, "bar" | "func">'. |
86 |
| - rest2.func; |
87 |
| - ~~~~ |
88 |
| -!!! error TS2339: Property 'func' does not exist on type '{ foo: string; }'. |
89 |
| - rest3.func; |
90 |
| - ~~~~ |
91 |
| -!!! error TS2339: Property 'func' does not exist on type 'Omit<T, "foo" | "bar" | "func">'. |
92 |
| - rest4.func; |
93 |
| - ~~~~ |
94 |
| -!!! error TS2339: Property 'func' does not exist on type '{}'. |
| 122 | + rest1.method; |
| 123 | + ~~~~~~ |
| 124 | +!!! error TS2339: Property 'method' does not exist on type 'Omit<T, "getter" | "setter" | "method">'. |
| 125 | + rest2.method; |
| 126 | + ~~~~~~ |
| 127 | +!!! error TS2339: Property 'method' does not exist on type '{ normal: string; }'. |
| 128 | + rest3.method; |
| 129 | + ~~~~~~ |
| 130 | +!!! error TS2339: Property 'method' does not exist on type 'Omit<T, "normal" | "getter" | "setter" | "method">'. |
| 131 | + rest4.method; |
| 132 | + ~~~~~~ |
| 133 | +!!! error TS2339: Property 'method' does not exist on type '{}'. |
95 | 134 | }
|
96 | 135 |
|
0 commit comments