diff --git a/tests/baselines/reference/arrayConcat2.js b/tests/baselines/reference/arrayConcat2.js index 8db2d62e1d357..b5f9402263238 100644 --- a/tests/baselines/reference/arrayConcat2.js +++ b/tests/baselines/reference/arrayConcat2.js @@ -6,6 +6,14 @@ a.concat('Hello'); var b = new Array(); b.concat('hello'); + +// #26378 + +[1].concat(['']); + +// #26976 + +[].concat([1]); //// [arrayConcat2.js] @@ -14,3 +22,7 @@ a.concat("hello", 'world'); a.concat('Hello'); var b = new Array(); b.concat('hello'); +// #26378 +[1].concat(['']); +// #26976 +[].concat([1]); diff --git a/tests/baselines/reference/arrayConcat2.symbols b/tests/baselines/reference/arrayConcat2.symbols index 7da42f6dfcb5e..03b489dca0b2a 100644 --- a/tests/baselines/reference/arrayConcat2.symbols +++ b/tests/baselines/reference/arrayConcat2.symbols @@ -21,3 +21,15 @@ b.concat('hello'); >b : Symbol(b, Decl(arrayConcat2.ts, 5, 3)) >concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +// #26378 + +[1].concat(['']); +>[1].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +// #26976 + +[].concat([1]); +>[].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types index fc1ea6fc2b57e..3df5096fcc774 100644 --- a/tests/baselines/reference/arrayConcat2.types +++ b/tests/baselines/reference/arrayConcat2.types @@ -1,7 +1,7 @@ === tests/cases/compiler/arrayConcat2.ts === var a: string[] = []; >a : string[] ->[] : undefined[] +>[] : never[] a.concat("hello", 'world'); >a.concat("hello", 'world') : string[] @@ -30,3 +30,24 @@ b.concat('hello'); >concat : { (...items: (string | ConcatArray)[]): string[]; (...items: (U | ConcatArray)[]): (string | U)[]; } >'hello' : "hello" +// #26378 + +[1].concat(['']); +>[1].concat(['']) : (string | number)[] +>[1].concat : { (...items: (number | ConcatArray)[]): number[]; (...items: (U | ConcatArray)[]): (number | U)[]; } +>[1] : number[] +>1 : 1 +>concat : { (...items: (number | ConcatArray)[]): number[]; (...items: (U | ConcatArray)[]): (number | U)[]; } +>[''] : string[] +>'' : "" + +// #26976 + +[].concat([1]); +>[].concat([1]) : number[] +>[].concat : { (...items: ConcatArray[]): never[]; (...items: (U | ConcatArray)[]): U[]; } +>[] : never[] +>concat : { (...items: ConcatArray[]): never[]; (...items: (U | ConcatArray)[]): U[]; } +>[1] : number[] +>1 : 1 + diff --git a/tests/cases/compiler/arrayConcat2.ts b/tests/cases/compiler/arrayConcat2.ts index e69730a63a37c..a3a6918d1934e 100644 --- a/tests/cases/compiler/arrayConcat2.ts +++ b/tests/cases/compiler/arrayConcat2.ts @@ -5,3 +5,12 @@ a.concat('Hello'); var b = new Array(); b.concat('hello'); + +// #26378 + +[1].concat(['']); + +// #26976 + +// @strictNullChecks: true +[].concat([1]);