1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
tests/cases/compiler/restParameterWithBindingPattern3.ts(1,16): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/compiler/restParameterWithBindingPattern3.ts(1,23): error TS2322: Type 'boolean' is not assignable to type 'string'.
tests/cases/compiler/restParameterWithBindingPattern3.ts(3,23): error TS1186: A rest element cannot have an initializer.
tests/cases/compiler/restParameterWithBindingPattern3.ts(5,30): error TS2493: Tuple type '[boolean, string, number]' of length '3' has no element at index '3'.
tests/cases/compiler/restParameterWithBindingPattern3.ts(7,23): error TS2493: Tuple type '[boolean, string, number]' of length '3' has no element at index '3'.
tests/cases/compiler/restParameterWithBindingPattern3.ts(9,19): error TS2322: Type 'number' is not assignable to type 'boolean'.
tests/cases/compiler/restParameterWithBindingPattern3.ts(9,29): error TS2322: Type 'boolean' is not assignable to type 'string'.
tests/cases/compiler/restParameterWithBindingPattern3.ts(9,48): error TS2566: A rest element cannot have a property name.
==== tests/cases/compiler/restParameterWithBindingPattern3.ts (8 errors) ====
function a(...[a = 1, b = true]: string[]) { }
~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
function b(...[...foo = []]: string[]) { }
~
!!! error TS1186: A rest element cannot have an initializer.
function c(...{0: a, length, 3: d}: [boolean, string, number]) { }
~
!!! error TS2493: Tuple type '[boolean, string, number]' of length '3' has no element at index '3'.
function d(...[a, , , d]: [boolean, string, number]) { }
~
!!! error TS2493: Tuple type '[boolean, string, number]' of length '3' has no element at index '3'.
function e(...{0: a = 1, 1: b = true, ...rest: rest}: [boolean, string, number]) { }
~
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
~~~~
!!! error TS2566: A rest element cannot have a property name.
|