Skip to content

Commit 9531d92

Browse files
committed
update test with pr feedback
1 parent 321bb9a commit 9531d92

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

tests/baselines/reference/typeGuardInClass.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ let x: string | number;
44
if (typeof x === "string") {
55
let n = class {
66
constructor() {
7-
x; // Should be "string"
7+
let y: string = x;
88
}
99
}
1010
}
1111
else {
1212
let m = class {
1313
constructor() {
14-
x; // Should be "number"
14+
let y: number = x;
1515
}
1616
}
1717
}
@@ -22,15 +22,15 @@ var x;
2222
if (typeof x === "string") {
2323
var n = (function () {
2424
function class_1() {
25-
x; // Should be "string"
25+
var y = x;
2626
}
2727
return class_1;
2828
})();
2929
}
3030
else {
3131
var m = (function () {
3232
function class_2() {
33-
x; // Should be "number"
33+
var y = x;
3434
}
3535
return class_2;
3636
})();

tests/baselines/reference/typeGuardInClass.symbols

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ if (typeof x === "string") {
99
>n : Symbol(n, Decl(typeGuardInClass.ts, 3, 7))
1010

1111
constructor() {
12-
x; // Should be "string"
12+
let y: string = x;
13+
>y : Symbol(y, Decl(typeGuardInClass.ts, 5, 15))
1314
>x : Symbol(x, Decl(typeGuardInClass.ts, 0, 3))
1415
}
1516
}
@@ -19,7 +20,8 @@ else {
1920
>m : Symbol(m, Decl(typeGuardInClass.ts, 10, 7))
2021

2122
constructor() {
22-
x; // Should be "number"
23+
let y: number = x;
24+
>y : Symbol(y, Decl(typeGuardInClass.ts, 12, 15))
2325
>x : Symbol(x, Decl(typeGuardInClass.ts, 0, 3))
2426
}
2527
}

tests/baselines/reference/typeGuardInClass.types

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,23 @@ if (typeof x === "string") {
1010

1111
let n = class {
1212
>n : typeof (Anonymous class)
13-
>class { constructor() { x; // Should be "string" } } : typeof (Anonymous class)
13+
>class { constructor() { let y: string = x; } } : typeof (Anonymous class)
1414

1515
constructor() {
16-
x; // Should be "string"
16+
let y: string = x;
17+
>y : string
1718
>x : string
1819
}
1920
}
2021
}
2122
else {
2223
let m = class {
2324
>m : typeof (Anonymous class)
24-
>class { constructor() { x; // Should be "number" } } : typeof (Anonymous class)
25+
>class { constructor() { let y: number = x; } } : typeof (Anonymous class)
2526

2627
constructor() {
27-
x; // Should be "number"
28+
let y: number = x;
29+
>y : number
2830
>x : number
2931
}
3032
}

tests/cases/conformance/expressions/typeGuards/typeGuardInClass.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ let x: string | number;
33
if (typeof x === "string") {
44
let n = class {
55
constructor() {
6-
x; // Should be "string"
6+
let y: string = x;
77
}
88
}
99
}
1010
else {
1111
let m = class {
1212
constructor() {
13-
x; // Should be "number"
13+
let y: number = x;
1414
}
1515
}
1616
}

0 commit comments

Comments
 (0)