Bind is Bad
bind(thisArg: any, ...argArray: any[]): any;function twoParams(a:number,b:number) {
return a + b;
}
let curryOne = twoParams.bind(null,123);
curryOne(456); // Okay but is not type checked!
curryOne('456'); // Allowed because it wasn't type checked!function twoParams(a:number,b:number) {
return a + b;
}
let curryOne = (x:number)=>twoParams(123,x);
curryOne(456); // Okay and type checked!
curryOne('456'); // Error!クラスメンバ
最終更新