bind ponyfill type def (#12559)

This commit is contained in:
Steve 2016-11-08 15:17:25 +00:00 committed by Masahiro Wakame
parent 8b21b7adde
commit 988774a261
3 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,8 @@
import ponyBind = require('bind-ponyfill');
let boundFn: Function;
boundFn = ponyBind(() => { console.log(this); }, 'Hello world!');
boundFn = ponyBind((...args: Array<string>) => { console.log(this, ...args); }, 'Hello world!', 'arg1');
boundFn = ponyBind((...args: Array<string>) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2');
boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2);

7
bind-ponyfill/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Type definitions for bind-ponyfill 0.1.0
// Project: https://www.npmjs.com/package/bind-ponyfill
// Definitions by: Steve Jenkins <https://github.com/skysteve>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function ponyBind(fn: Function, that: any, ...args: Array<any>): Function;
export = ponyBind;

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bind-ponyfill-tests.ts"
]
}