18 lines
802 B
Text
18 lines
802 B
Text
|
==== tests/cases/conformance/functions/functionOverloadErrorsSyntax.ts (3 errors) ====
|
||
|
//Function overload signature with optional parameter followed by non-optional parameter
|
||
|
function fn4a(x?: number, y: string);
|
||
|
~
|
||
|
!!! A required parameter cannot follow an optional parameter.
|
||
|
function fn4a() { }
|
||
|
|
||
|
function fn4b(n: string, x?: number, y: string);
|
||
|
~
|
||
|
!!! A required parameter cannot follow an optional parameter.
|
||
|
function fn4b() { }
|
||
|
|
||
|
//Function overload signature with rest param followed by non-optional parameter
|
||
|
function fn5(x: string, ...y: any[], z: string);
|
||
|
~
|
||
|
!!! A rest parameter must be last in a parameter list.
|
||
|
function fn5() { }
|
||
|
|