2023-02-23 10:55:58 +03:00
|
|
|
|
// @target:es6
|
2021-01-15 13:30:44 +03:00
|
|
|
|
var f1 = () => { }
|
|
|
|
|
var f2 = (x: string, y: string) => { }
|
|
|
|
|
var f3 = (x: string, y: number, ...rest) => { }
|
|
|
|
|
var f4 = (x: string, y: number, z=10) => { }
|
|
|
|
|
function foo(func: () => boolean) { }
|
|
|
|
|
foo(() => true);
|
|
|
|
|
foo(() => { return false; });
|
|
|
|
|
|
|
|
|
|
// Binding patterns in arrow functions
|
|
|
|
|
var p1 = ([a]) => { };
|
|
|
|
|
var p2 = ([...a]) => { };
|
|
|
|
|
var p3 = ([, a]) => { };
|
|
|
|
|
var p4 = ([, ...a]) => { };
|
|
|
|
|
var p5 = ([a = 1]) => { };
|
|
|
|
|
var p6 = ({ a }) => { };
|
|
|
|
|
var p7 = ({ a: { b } }) => { };
|
|
|
|
|
var p8 = ({ a = 1 }) => { };
|
|
|
|
|
var p9 = ({ a: { b = 1 } = { b: 1 } }) => { };
|
|
|
|
|
var p10 = ([{ value, done }]) => { };
|