diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index be1a0e5a2c3..4960940d3ab 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(12,10): error TS2339: Property 'bar' does not exist on type 'A'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(62,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(63,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(82,10): error TS2339: Property 'bar' does not exist on type 'D'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(108,10): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(109,10): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(131,11): error TS2339: Property 'foo' does not exist on type 'string | F'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(132,11): error TS2339: Property 'bar' does not exist on type 'string | F'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(157,11): error TS2339: Property 'foo2' does not exist on type 'G1'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(179,11): error TS2339: Property 'bar' does not exist on type 'H'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(65,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(111,10): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(134,11): error TS2339: Property 'foo' does not exist on type 'string | F'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'. ==== tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts (12 errors) ==== @@ -69,17 +69,20 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru } interface C1 { foo: string; + c: string; bar1: number; } interface C2 { foo: string; + c: string; bar2: number; } declare var C: CConstructor; var obj5: C1 | A; - if (obj5 instanceof C) { // narrowed to C1. + if (obj5 instanceof C) { // narrowed to C1|C2. obj5.foo; + obj5.c; obj5.bar1; ~~~~ !!! error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. @@ -130,7 +133,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru declare var E: EConstructor; var obj9: E1 | A; - if (obj9 instanceof E) { // narrowed to E1. + if (obj9 instanceof E) { // narrowed to E1 | E2 obj9.foo; obj9.bar1; ~~~~ diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js index e5b12bacb1f..7e6b3324470 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.js @@ -49,17 +49,20 @@ interface CConstructor { } interface C1 { foo: string; + c: string; bar1: number; } interface C2 { foo: string; + c: string; bar2: number; } declare var C: CConstructor; var obj5: C1 | A; -if (obj5 instanceof C) { // narrowed to C1. +if (obj5 instanceof C) { // narrowed to C1|C2. obj5.foo; + obj5.c; obj5.bar1; obj5.bar2; } @@ -104,7 +107,7 @@ interface E2 { declare var E: EConstructor; var obj9: E1 | A; -if (obj9 instanceof E) { // narrowed to E1. +if (obj9 instanceof E) { // narrowed to E1 | E2 obj9.foo; obj9.bar1; obj9.bar2; @@ -213,6 +216,7 @@ if (obj4 instanceof B) { var obj5; if (obj5 instanceof C) { obj5.foo; + obj5.c; obj5.bar1; obj5.bar2; } diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts index fee92ff10ca..b81dd26652b 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts @@ -48,17 +48,20 @@ interface CConstructor { } interface C1 { foo: string; + c: string; bar1: number; } interface C2 { foo: string; + c: string; bar2: number; } declare var C: CConstructor; var obj5: C1 | A; -if (obj5 instanceof C) { // narrowed to C1. +if (obj5 instanceof C) { // narrowed to C1|C2. obj5.foo; + obj5.c; obj5.bar1; obj5.bar2; } @@ -103,7 +106,7 @@ interface E2 { declare var E: EConstructor; var obj9: E1 | A; -if (obj9 instanceof E) { // narrowed to E1. +if (obj9 instanceof E) { // narrowed to E1 | E2 obj9.foo; obj9.bar1; obj9.bar2;