Skip to content

Commit cc8f326

Browse files
committed
accept new baselines
1 parent 59c09d9 commit cc8f326

File tree

2 files changed

+81
-17
lines changed

2 files changed

+81
-17
lines changed

tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(12,10): error TS2339: Property 'bar' does not exist on type 'A'.
2+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(18,10): error TS2339: Property 'bar' does not exist on type 'A'.
23
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type 'string' is not assignable to type 'number'.
34
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B<number>'.
5+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(41,10): error TS2339: Property 'bar' does not exist on type 'B<any>'.
46
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1'.
7+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(72,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'.
8+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(73,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'.
59
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'.
10+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(91,10): error TS2339: Property 'bar' does not exist on type 'D'.
611
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1'.
12+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(118,11): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'.
13+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(119,11): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'.
714
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'.
815
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'.
916
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'.
17+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(166,11): error TS2339: Property 'foo2' does not exist on type 'G1'.
1018
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'.
19+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(187,11): error TS2339: Property 'foo1' does not exist on type 'H'.
20+
tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(188,11): error TS2339: Property 'foo2' does not exist on type 'H'.
1121

1222

13-
==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts (10 errors) ====
23+
==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts (20 errors) ====
1424
interface AConstructor {
1525
new (): A;
1626
}
@@ -28,9 +38,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
2838
}
2939

3040
var obj2: any;
31-
if (obj2 instanceof A) { // can't narrow type from 'any'
41+
if (obj2 instanceof A) {
3242
obj2.foo;
3343
obj2.bar;
44+
~~~
45+
!!! error TS2339: Property 'bar' does not exist on type 'A'.
3446
}
3547

3648
// a construct signature with generics
@@ -54,10 +66,12 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
5466
}
5567

5668
var obj4: any;
57-
if (obj4 instanceof B) { // can't narrow type from 'any'
69+
if (obj4 instanceof B) {
5870
obj4.foo = "str";
5971
obj4.foo = 1;
6072
obj4.bar = "str";
73+
~~~
74+
!!! error TS2339: Property 'bar' does not exist on type 'B<any>'.
6175
}
6276

6377
// has multiple construct signature
@@ -88,10 +102,14 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
88102
}
89103

90104
var obj6: any;
91-
if (obj6 instanceof C) { // can't narrow type from 'any'
105+
if (obj6 instanceof C) {
92106
obj6.foo;
93107
obj6.bar1;
108+
~~~~
109+
!!! error TS2339: Property 'bar1' does not exist on type 'C1 | C2'.
94110
obj6.bar2;
111+
~~~~
112+
!!! error TS2339: Property 'bar2' does not exist on type 'C1 | C2'.
95113
}
96114

97115
// with object type literal
@@ -109,9 +127,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
109127
}
110128

111129
var obj8: any;
112-
if (obj8 instanceof D) { // can't narrow type from 'any'
130+
if (obj8 instanceof D) {
113131
obj8.foo;
114132
obj8.bar;
133+
~~~
134+
!!! error TS2339: Property 'bar' does not exist on type 'D'.
115135
}
116136

117137
// a construct signature that returns a union type
@@ -138,10 +158,14 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
138158
}
139159

140160
var obj10: any;
141-
if (obj10 instanceof E) { // can't narrow type from 'any'
161+
if (obj10 instanceof E) {
142162
obj10.foo;
143163
obj10.bar1;
164+
~~~~
165+
!!! error TS2339: Property 'bar1' does not exist on type 'E1 | E2'.
144166
obj10.bar2;
167+
~~~~
168+
!!! error TS2339: Property 'bar2' does not exist on type 'E1 | E2'.
145169
}
146170

147171
// a construct signature that returns any
@@ -165,7 +189,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
165189
}
166190

167191
var obj12: any;
168-
if (obj12 instanceof F) { // can't narrow type from 'any'
192+
if (obj12 instanceof F) {
169193
obj12.foo;
170194
obj12.bar;
171195
}
@@ -192,9 +216,11 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
192216
}
193217

194218
var obj14: any;
195-
if (obj14 instanceof G) { // can't narrow type from 'any'
219+
if (obj14 instanceof G) {
196220
obj14.foo1;
197221
obj14.foo2;
222+
~~~~
223+
!!! error TS2339: Property 'foo2' does not exist on type 'G1'.
198224
}
199225

200226
// a type with a prototype that has any type
@@ -216,8 +242,24 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru
216242
}
217243

218244
var obj16: any;
219-
if (obj16 instanceof H) { // can't narrow type from 'any'
245+
if (obj16 instanceof H) {
220246
obj16.foo1;
247+
~~~~
248+
!!! error TS2339: Property 'foo1' does not exist on type 'H'.
221249
obj16.foo2;
250+
~~~~
251+
!!! error TS2339: Property 'foo2' does not exist on type 'H'.
252+
}
253+
254+
var obj17: any;
255+
if (obj17 instanceof Object) { // can't narrow type from 'any' to 'Object'
256+
obj17.foo1;
257+
obj17.foo2;
258+
}
259+
260+
var obj18: any;
261+
if (obj18 instanceof Function) { // can't narrow type from 'any' to 'Function'
262+
obj18.foo1;
263+
obj18.foo2;
222264
}
223265

tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if (obj1 instanceof A) { // narrowed to A.
1414
}
1515

1616
var obj2: any;
17-
if (obj2 instanceof A) { // can't narrow type from 'any'
17+
if (obj2 instanceof A) {
1818
obj2.foo;
1919
obj2.bar;
2020
}
@@ -36,7 +36,7 @@ if (obj3 instanceof B) { // narrowed to B<number>.
3636
}
3737

3838
var obj4: any;
39-
if (obj4 instanceof B) { // can't narrow type from 'any'
39+
if (obj4 instanceof B) {
4040
obj4.foo = "str";
4141
obj4.foo = 1;
4242
obj4.bar = "str";
@@ -68,7 +68,7 @@ if (obj5 instanceof C) { // narrowed to C1|C2.
6868
}
6969

7070
var obj6: any;
71-
if (obj6 instanceof C) { // can't narrow type from 'any'
71+
if (obj6 instanceof C) {
7272
obj6.foo;
7373
obj6.bar1;
7474
obj6.bar2;
@@ -87,7 +87,7 @@ if (obj7 instanceof D) { // narrowed to D.
8787
}
8888

8989
var obj8: any;
90-
if (obj8 instanceof D) { // can't narrow type from 'any'
90+
if (obj8 instanceof D) {
9191
obj8.foo;
9292
obj8.bar;
9393
}
@@ -114,7 +114,7 @@ if (obj9 instanceof E) { // narrowed to E1 | E2
114114
}
115115

116116
var obj10: any;
117-
if (obj10 instanceof E) { // can't narrow type from 'any'
117+
if (obj10 instanceof E) {
118118
obj10.foo;
119119
obj10.bar1;
120120
obj10.bar2;
@@ -137,7 +137,7 @@ if (obj11 instanceof F) { // can't type narrowing, construct signature returns a
137137
}
138138

139139
var obj12: any;
140-
if (obj12 instanceof F) { // can't narrow type from 'any'
140+
if (obj12 instanceof F) {
141141
obj12.foo;
142142
obj12.bar;
143143
}
@@ -162,7 +162,7 @@ if (obj13 instanceof G) { // narrowed to G1. G1 is return type of prototype prop
162162
}
163163

164164
var obj14: any;
165-
if (obj14 instanceof G) { // can't narrow type from 'any'
165+
if (obj14 instanceof G) {
166166
obj14.foo1;
167167
obj14.foo2;
168168
}
@@ -184,10 +184,22 @@ if (obj15 instanceof H) { // narrowed to H.
184184
}
185185

186186
var obj16: any;
187-
if (obj16 instanceof H) { // can't narrow type from 'any'
187+
if (obj16 instanceof H) {
188188
obj16.foo1;
189189
obj16.foo2;
190190
}
191+
192+
var obj17: any;
193+
if (obj17 instanceof Object) { // can't narrow type from 'any' to 'Object'
194+
obj17.foo1;
195+
obj17.foo2;
196+
}
197+
198+
var obj18: any;
199+
if (obj18 instanceof Function) { // can't narrow type from 'any' to 'Function'
200+
obj18.foo1;
201+
obj18.foo2;
202+
}
191203

192204

193205
//// [typeGuardsWithInstanceOfByConstructorSignature.js]
@@ -278,3 +290,13 @@ if (obj16 instanceof H) {
278290
obj16.foo1;
279291
obj16.foo2;
280292
}
293+
var obj17;
294+
if (obj17 instanceof Object) {
295+
obj17.foo1;
296+
obj17.foo2;
297+
}
298+
var obj18;
299+
if (obj18 instanceof Function) {
300+
obj18.foo1;
301+
obj18.foo2;
302+
}

0 commit comments

Comments
 (0)