Files
test-repo/tests/flow/function/rest.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

20 lines
400 B
JavaScript

/* regression tests */
function rest_array<T>(...xs: Array<T>): T {
return xs[0];
}
// Warn, singleton tuple types don't represent rest params
function rest_tuple<T>(...xs: [T]): T {
return xs[0];
}
function rest_any(...xs: any): any {
return xs[0];
}
// Warn, arbitrary subtypes of an array type don't represent rest params
function rest_t<U, T: Array<U>>(...xs: T): U {
return xs[0];
}