diff --git a/bind-ponyfill/bind-ponyfill-tests.ts b/bind-ponyfill/bind-ponyfill-tests.ts new file mode 100644 index 0000000000..8c5ba7ec05 --- /dev/null +++ b/bind-ponyfill/bind-ponyfill-tests.ts @@ -0,0 +1,8 @@ +import ponyBind = require('bind-ponyfill'); + +let boundFn: Function; + +boundFn = ponyBind(() => { console.log(this); }, 'Hello world!'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2'); +boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2); \ No newline at end of file diff --git a/bind-ponyfill/index.d.ts b/bind-ponyfill/index.d.ts new file mode 100644 index 0000000000..8fb2227627 --- /dev/null +++ b/bind-ponyfill/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for bind-ponyfill 0.1.0 +// Project: https://www.npmjs.com/package/bind-ponyfill +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function ponyBind(fn: Function, that: any, ...args: Array): Function; +export = ponyBind; \ No newline at end of file diff --git a/bind-ponyfill/tsconfig.json b/bind-ponyfill/tsconfig.json new file mode 100644 index 0000000000..44c1eca54a --- /dev/null +++ b/bind-ponyfill/tsconfig.json @@ -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" + ] +}