Skip to content

Commit 7d6f983

Browse files
committed
Add test for initial behavior
1 parent 4761ba6 commit 7d6f983

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [controlFlowCommaExpressionAssertionMultiple.ts]
2+
function Narrow<T>(value: any): asserts value is T {}
3+
4+
function func(foo: any, bar: any) {
5+
Narrow<number>(foo), Narrow<string>(bar);
6+
foo;
7+
bar;
8+
}
9+
10+
11+
//// [controlFlowCommaExpressionAssertionMultiple.js]
12+
function Narrow(value) { }
13+
function func(foo, bar) {
14+
Narrow(foo), Narrow(bar);
15+
foo;
16+
bar;
17+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/controlFlowCommaExpressionAssertionMultiple.ts ===
2+
function Narrow<T>(value: any): asserts value is T {}
3+
>Narrow : Symbol(Narrow, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 0))
4+
>T : Symbol(T, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 16))
5+
>value : Symbol(value, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 19))
6+
>value : Symbol(value, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 19))
7+
>T : Symbol(T, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 16))
8+
9+
function func(foo: any, bar: any) {
10+
>func : Symbol(func, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 53))
11+
>foo : Symbol(foo, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 14))
12+
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 23))
13+
14+
Narrow<number>(foo), Narrow<string>(bar);
15+
>Narrow : Symbol(Narrow, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 0))
16+
>foo : Symbol(foo, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 14))
17+
>Narrow : Symbol(Narrow, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 0, 0))
18+
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 23))
19+
20+
foo;
21+
>foo : Symbol(foo, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 14))
22+
23+
bar;
24+
>bar : Symbol(bar, Decl(controlFlowCommaExpressionAssertionMultiple.ts, 2, 23))
25+
}
26+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/controlFlowCommaExpressionAssertionMultiple.ts ===
2+
function Narrow<T>(value: any): asserts value is T {}
3+
>Narrow : <T>(value: any) => asserts value is T
4+
>value : any
5+
6+
function func(foo: any, bar: any) {
7+
>func : (foo: any, bar: any) => void
8+
>foo : any
9+
>bar : any
10+
11+
Narrow<number>(foo), Narrow<string>(bar);
12+
>Narrow<number>(foo), Narrow<string>(bar) : void
13+
>Narrow<number>(foo) : void
14+
>Narrow : <T>(value: any) => asserts value is T
15+
>foo : any
16+
>Narrow<string>(bar) : void
17+
>Narrow : <T>(value: any) => asserts value is T
18+
>bar : any
19+
20+
foo;
21+
>foo : number
22+
23+
bar;
24+
>bar : any
25+
}
26+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function Narrow<T>(value: any): asserts value is T {}
2+
3+
function func(foo: any, bar: any) {
4+
Narrow<number>(foo), Narrow<string>(bar);
5+
foo;
6+
bar;
7+
}

0 commit comments

Comments
 (0)