Skip to content

Commit

Permalink
update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gabritto committed Jul 22, 2021
1 parent c14d573 commit b4f2f8c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/baselines/reference/controlFlowForInStatement2.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ let stringB: string = 'b';
if ((stringB as 'b') in c) {
c; // narrowed to `B`
}


if ((stringB as ('a' | 'b')) in c) {
c; // not narrowed
}

//// [controlFlowForInStatement2.js]
var keywordA = 'a';
Expand All @@ -35,3 +38,6 @@ var stringB = 'b';
if (stringB in c) {
c; // narrowed to `B`
}
if (stringB in c) {
c; // not narrowed
}
7 changes: 7 additions & 0 deletions tests/baselines/reference/controlFlowForInStatement2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ if ((stringB as 'b') in c) {
>c : Symbol(c, Decl(controlFlowForInStatement2.ts, 6, 13))
}

if ((stringB as ('a' | 'b')) in c) {
>stringB : Symbol(stringB, Decl(controlFlowForInStatement2.ts, 16, 3))
>c : Symbol(c, Decl(controlFlowForInStatement2.ts, 6, 13))

c; // not narrowed
>c : Symbol(c, Decl(controlFlowForInStatement2.ts, 6, 13))
}
10 changes: 10 additions & 0 deletions tests/baselines/reference/controlFlowForInStatement2.types
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ if ((stringB as 'b') in c) {
>c : B
}

if ((stringB as ('a' | 'b')) in c) {
>(stringB as ('a' | 'b')) in c : boolean
>(stringB as ('a' | 'b')) : "a" | "b"
>stringB as ('a' | 'b') : "a" | "b"
>stringB : string
>c : A | B

c; // not narrowed
>c : A | B
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ let stringB: string = 'b';
if ((stringB as 'b') in c) {
c; // narrowed to `B`
}

if ((stringB as ('a' | 'b')) in c) {
c; // not narrowed
}

0 comments on commit b4f2f8c

Please sign in to comment.