Skip to content

Commit c815e38

Browse files
committed
Add tests
1 parent 724d27d commit c815e38

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

tests/baselines/reference/arrayConcat2.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ a.concat('Hello');
66

77
var b = new Array<string>();
88
b.concat('hello');
9+
10+
// #19535
11+
12+
const [x] = (undefined as unknown as string[][]).concat([""]);
13+
x == "";
914

1015

1116
//// [arrayConcat2.js]
@@ -14,3 +19,6 @@ a.concat("hello", 'world');
1419
a.concat('Hello');
1520
var b = new Array();
1621
b.concat('hello');
22+
// #19535
23+
var x = undefined.concat([""])[0];
24+
x == "";

tests/baselines/reference/arrayConcat2.symbols

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,14 @@ b.concat('hello');
2121
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
2222
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2323

24+
// #19535
25+
26+
const [x] = (undefined as unknown as string[][]).concat([""]);
27+
>x : Symbol(x, Decl(arrayConcat2.ts, 10, 7))
28+
>(undefined as unknown as string[][]).concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
29+
>undefined : Symbol(undefined)
30+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
31+
32+
x == "";
33+
>x : Symbol(x, Decl(arrayConcat2.ts, 10, 7))
34+

tests/baselines/reference/arrayConcat2.types

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,22 @@ b.concat('hello');
3030
>concat : { (...items: ConcatArray<string>[]): string[]; <U extends (string | ConcatArray<string>)[]>(...items: U): (string | Flatten<U[number]>)[]; }
3131
>'hello' : "hello"
3232

33+
// #19535
34+
35+
const [x] = (undefined as unknown as string[][]).concat([""]);
36+
>x : string | string[]
37+
>(undefined as unknown as string[][]).concat([""]) : (string | string[])[]
38+
>(undefined as unknown as string[][]).concat : { (...items: ConcatArray<string[]>[]): string[][]; <U extends (string[] | ConcatArray<string[]>)[]>(...items: U): (string[] | Flatten<U[number]>)[]; }
39+
>(undefined as unknown as string[][]) : string[][]
40+
>undefined as unknown as string[][] : string[][]
41+
>undefined as unknown : unknown
42+
>undefined : undefined
43+
>concat : { (...items: ConcatArray<string[]>[]): string[][]; <U extends (string[] | ConcatArray<string[]>)[]>(...items: U): (string[] | Flatten<U[number]>)[]; }
44+
>[""] : string[]
45+
>"" : ""
46+
47+
x == "";
48+
>x == "" : boolean
49+
>x : string | string[]
50+
>"" : ""
51+

tests/cases/compiler/arrayConcat2.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ a.concat('Hello');
55

66
var b = new Array<string>();
77
b.concat('hello');
8+
9+
// #19535
10+
11+
const [x] = (undefined as unknown as string[][]).concat([""]);
12+
x == "";

0 commit comments

Comments
 (0)