2017-04-08 17:52:38 +03:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
exports[`spread.js 1`] = `
|
2017-04-12 23:41:51 +03:00
|
|
|
declare var iterableOf123: Iterable<123>;
|
2017-04-08 17:52:38 +03:00
|
|
|
function fun(x: 'hi', y: 123) {}
|
|
|
|
fun('hi', ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty
|
|
|
|
|
|
|
|
function funWithRestArray(x: 'hi', y: 123, ...rest: Array<number>) {}
|
|
|
|
|
|
|
|
funWithRestArray('hi', 123, ...iterableOf123); // Ok
|
|
|
|
funWithRestArray('hi', ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty
|
|
|
|
funWithRestArray('hi', ...iterableOf123, ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty
|
|
|
|
|
|
|
|
// 2 errors
|
|
|
|
// 1. 'bye' ~> 123 in case the first spread is empty
|
|
|
|
// 2. 'bye' ~> number in case the first spread is not empty
|
|
|
|
funWithRestArray('hi', ...iterableOf123, 'bye', ...iterableOf123);
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
declare var iterableOf123: Iterable<123>;
|
2017-04-12 23:41:51 +03:00
|
|
|
function fun(x: "hi", y: 123) {}
|
|
|
|
fun("hi", ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty
|
2017-04-08 17:52:38 +03:00
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
function funWithRestArray(x: "hi", y: 123, ...rest: Array<number>) {}
|
2017-04-08 17:52:38 +03:00
|
|
|
|
2017-04-12 23:41:51 +03:00
|
|
|
funWithRestArray("hi", 123, ...iterableOf123); // Ok
|
|
|
|
funWithRestArray("hi", ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty
|
|
|
|
funWithRestArray("hi", ...iterableOf123, ...iterableOf123); // No error - ignore the fact iterableOf123 could be empty
|
2017-04-08 17:52:38 +03:00
|
|
|
|
|
|
|
// 2 errors
|
|
|
|
// 1. 'bye' ~> 123 in case the first spread is empty
|
|
|
|
// 2. 'bye' ~> number in case the first spread is not empty
|
2017-04-12 23:41:51 +03:00
|
|
|
funWithRestArray("hi", ...iterableOf123, "bye", ...iterableOf123);
|
|
|
|
|
2017-04-08 17:52:38 +03:00
|
|
|
`;
|