Skip to content

Instance of else clause #5092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6362,9 +6362,10 @@ namespace ts {

function narrowTypeByInstanceof(type: Type, expr: BinaryExpression, assumeTrue: boolean): Type {
// Check that type is not any, assumed result is true, and we have variable symbol on the left
if (isTypeAny(type) || !assumeTrue || expr.left.kind !== SyntaxKind.Identifier || getResolvedSymbol(<Identifier>expr.left) !== symbol) {
if (isTypeAny(type) || expr.left.kind !== SyntaxKind.Identifier || getResolvedSymbol(<Identifier>expr.left) !== symbol) {
return type;
}

// Check that right operand is a function type with a prototype property
let rightType = checkExpression(expr.right);
if (!isTypeSubtypeOf(rightType, globalFunctionType)) {
Expand Down Expand Up @@ -6396,6 +6397,13 @@ namespace ts {
}

if (targetType) {
if (!assumeTrue) {
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => !isTypeSubtypeOf(t, targetType)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RyanCavanaugh what happened with the idea that if the RHS type isn't a subtype of any types in the union, that we just discard the LHS type and take the RHS type? Is that something that we eventually went with?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember what we decided on that.

}
return type;
}

return getNarrowedType(type, targetType);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/narrowTypeByInstanceof.types
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
} else if (elementA instanceof Match && elementB instanceof Match) {
>elementA instanceof Match && elementB instanceof Match : boolean
>elementA instanceof Match : boolean
>elementA : FileMatch | Match
>elementA : Match | FileMatch
>Match : typeof Match
>elementB instanceof Match : boolean
>elementB : FileMatch | Match
Expand Down
112 changes: 92 additions & 20 deletions tests/baselines/reference/typeGuardOfFormInstanceOf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,58 @@ class C2 {
class D1 extends C1 {
p3: number;
}
class C3 {
p4: number;
}
var str: string;
var num: number;
var strOrNum: string | number;

var c1Orc2: C1 | C2;
str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1
num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2
str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1
num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1
var ctor1: C1 | C2;
str = ctor1 instanceof C1 && ctor1.p1; // C1
num = ctor1 instanceof C2 && ctor1.p2; // C2
str = ctor1 instanceof D1 && ctor1.p1; // D1
num = ctor1 instanceof D1 && ctor1.p3; // D1

var ctor2: C2 | D1;
num = ctor2 instanceof C2 && ctor2.p2; // C2
num = ctor2 instanceof D1 && ctor2.p3; // D1
str = ctor2 instanceof D1 && ctor2.p1; // D1
var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1

var ctor3: C1 | C2;
if (ctor3 instanceof C1) {
ctor3.p1; // C1
}
else {
ctor3.p2; // C2
}

var c2Ord1: C2 | D1;
num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2
num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1
str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1
var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1
var ctor4: C1 | C2 | C3;
if (ctor4 instanceof C1) {
ctor4.p1; // C1
}
else if (ctor4 instanceof C2) {
ctor4.p2; // C2
}
else {
ctor4.p4; // C3
}

var ctor5: C1 | D1 | C2;
if (ctor5 instanceof C1) {
ctor5.p1; // C1
}
else {
ctor5.p2; // C2
}

var ctor6: C1 | C2 | C3;
if (ctor6 instanceof C1 || ctor6 instanceof C2) {
}
else {
ctor6.p4; // C3
}

//// [typeGuardOfFormInstanceOf.js]
// A type guard of the form x instanceof C, where C is of a subtype of the global type 'Function'
Expand Down Expand Up @@ -58,16 +95,51 @@ var D1 = (function (_super) {
}
return D1;
})(C1);
var C3 = (function () {
function C3() {
}
return C3;
})();
var str;
var num;
var strOrNum;
var c1Orc2;
str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1
num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2
str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1
num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1
var c2Ord1;
num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2
num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1
str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1
var r2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1
var ctor1;
str = ctor1 instanceof C1 && ctor1.p1; // C1
num = ctor1 instanceof C2 && ctor1.p2; // C2
str = ctor1 instanceof D1 && ctor1.p1; // D1
num = ctor1 instanceof D1 && ctor1.p3; // D1
var ctor2;
num = ctor2 instanceof C2 && ctor2.p2; // C2
num = ctor2 instanceof D1 && ctor2.p3; // D1
str = ctor2 instanceof D1 && ctor2.p1; // D1
var r2 = ctor2 instanceof C1 && ctor2; // C2 | D1
var ctor3;
if (ctor3 instanceof C1) {
ctor3.p1; // C1
}
else {
ctor3.p2; // C2
}
var ctor4;
if (ctor4 instanceof C1) {
ctor4.p1; // C1
}
else if (ctor4 instanceof C2) {
ctor4.p2; // C2
}
else {
ctor4.p4; // C3
}
var ctor5;
if (ctor5 instanceof C1) {
ctor5.p1; // C1
}
else {
ctor5.p2; // C2
}
var ctor6;
if (ctor6 instanceof C1 || ctor6 instanceof C2) {
}
else {
ctor6.p4; // C3
}
190 changes: 144 additions & 46 deletions tests/baselines/reference/typeGuardOfFormInstanceOf.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -24,86 +24,184 @@ class D1 extends C1 {
p3: number;
>p3 : Symbol(p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))
}
class C3 {
>C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1))

p4: number;
>p4 : Symbol(p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10))
}
var str: string;
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3))
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3))

var num: number;
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3))
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))

var strOrNum: string | number;
>strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormInstanceOf.ts, 17, 3))
>strOrNum : Symbol(strOrNum, Decl(typeGuardOfFormInstanceOf.ts, 20, 3))

var c1Orc2: C1 | C2;
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
var ctor1: C1 | C2;
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))

str = c1Orc2 instanceof C1 && c1Orc2.p1; // C1
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
str = ctor1 instanceof C1 && ctor1.p1; // C1
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>c1Orc2.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor1.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))

num = c1Orc2 instanceof C2 && c1Orc2.p2; // C2
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
num = ctor1 instanceof C2 && ctor1.p2; // C2
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
>c1Orc2.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor1.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))

str = c1Orc2 instanceof D1 && c1Orc2.p1; // D1
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
str = ctor1 instanceof D1 && ctor1.p1; // D1
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))
>c1Orc2.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor1.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))

num = c1Orc2 instanceof D1 && c1Orc2.p3; // D1
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
num = ctor1 instanceof D1 && ctor1.p3; // D1
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))
>c1Orc2.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))
>c1Orc2 : Symbol(c1Orc2, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor1.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))
>ctor1 : Symbol(ctor1, Decl(typeGuardOfFormInstanceOf.ts, 22, 3))
>p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))

var c2Ord1: C2 | D1;
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
var ctor2: C2 | D1;
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))

num = c2Ord1 instanceof C2 && c2Ord1.p2; // C2
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
num = ctor2 instanceof C2 && ctor2.p2; // C2
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
>c2Ord1.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
>ctor2.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))

num = c2Ord1 instanceof D1 && c2Ord1.p3; // D1
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 16, 3))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
num = ctor2 instanceof D1 && ctor2.p3; // D1
>num : Symbol(num, Decl(typeGuardOfFormInstanceOf.ts, 19, 3))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))
>c2Ord1.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
>ctor2.p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>p3 : Symbol(D1.p3, Decl(typeGuardOfFormInstanceOf.ts, 12, 21))

str = c2Ord1 instanceof D1 && c2Ord1.p1; // D1
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 15, 3))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
str = ctor2 instanceof D1 && ctor2.p1; // D1
>str : Symbol(str, Decl(typeGuardOfFormInstanceOf.ts, 18, 3))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))
>c2Ord1.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
>ctor2.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))

var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1
>r2 : Symbol(r2, Decl(typeGuardOfFormInstanceOf.ts, 29, 3))
var r2: D1 | C2 = ctor2 instanceof C1 && ctor2; // C2 | D1
>r2 : Symbol(r2, Decl(typeGuardOfFormInstanceOf.ts, 32, 3))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>ctor2 : Symbol(ctor2, Decl(typeGuardOfFormInstanceOf.ts, 28, 3))

var ctor3: C1 | C2;
>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))

if (ctor3 instanceof C1) {
>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))

ctor3.p1; // C1
>ctor3.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3))
>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
}
else {
ctor3.p2; // C2
>ctor3.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>ctor3 : Symbol(ctor3, Decl(typeGuardOfFormInstanceOf.ts, 34, 3))
>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
}

var ctor4: C1 | C2 | C3;
>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
>C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1))

if (ctor4 instanceof C1) {
>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>c2Ord1 : Symbol(c2Ord1, Decl(typeGuardOfFormInstanceOf.ts, 25, 3))

ctor4.p1; // C1
>ctor4.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3))
>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
}
else if (ctor4 instanceof C2) {
>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))

ctor4.p2; // C2
>ctor4.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3))
>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
}
else {
ctor4.p4; // C3
>ctor4.p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10))
>ctor4 : Symbol(ctor4, Decl(typeGuardOfFormInstanceOf.ts, 42, 3))
>p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10))
}

var ctor5: C1 | D1 | C2;
>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>D1 : Symbol(D1, Decl(typeGuardOfFormInstanceOf.ts, 11, 1))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))

if (ctor5 instanceof C1) {
>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))

ctor5.p1; // C1
>ctor5.p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3))
>p1 : Symbol(C1.p1, Decl(typeGuardOfFormInstanceOf.ts, 6, 10))
}
else {
ctor5.p2; // C2
>ctor5.p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
>ctor5 : Symbol(ctor5, Decl(typeGuardOfFormInstanceOf.ts, 53, 3))
>p2 : Symbol(C2.p2, Decl(typeGuardOfFormInstanceOf.ts, 9, 10))
}

var ctor6: C1 | C2 | C3;
>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
>C3 : Symbol(C3, Decl(typeGuardOfFormInstanceOf.ts, 14, 1))

if (ctor6 instanceof C1 || ctor6 instanceof C2) {
>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3))
>C1 : Symbol(C1, Decl(typeGuardOfFormInstanceOf.ts, 0, 0))
>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3))
>C2 : Symbol(C2, Decl(typeGuardOfFormInstanceOf.ts, 8, 1))
}
else {
ctor6.p4; // C3
>ctor6.p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10))
>ctor6 : Symbol(ctor6, Decl(typeGuardOfFormInstanceOf.ts, 61, 3))
>p4 : Symbol(C3.p4, Decl(typeGuardOfFormInstanceOf.ts, 15, 10))
}
Loading