diff --git a/types/raf/index.d.ts b/types/raf/index.d.ts new file mode 100644 index 0000000000..d54b1c6e6c --- /dev/null +++ b/types/raf/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for raf 3.4 +// Project: https://github.com/chrisdickinson/raf#readme +// Definitions by: Ben Lorantfy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const raf: { + (callback: (timestamp: number) => void): number; + cancel: (handle: number) => void; + polyfill: (globalObject?: any) => void; +}; + +export = raf; diff --git a/types/raf/raf-tests.ts b/types/raf/raf-tests.ts new file mode 100644 index 0000000000..c3da3cbd01 --- /dev/null +++ b/types/raf/raf-tests.ts @@ -0,0 +1,11 @@ +import * as raf from "raf"; + +const handle = raf((timestamp) => { + timestamp; // $ExpectType number +}); + +handle; // $ExpectType number + +raf.cancel(handle); +raf.polyfill(); +raf.polyfill({}); diff --git a/types/raf/tsconfig.json b/types/raf/tsconfig.json new file mode 100644 index 0000000000..16b1eada34 --- /dev/null +++ b/types/raf/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "raf-tests.ts" + ] +} diff --git a/types/raf/tslint.json b/types/raf/tslint.json new file mode 100644 index 0000000000..a0051c9352 --- /dev/null +++ b/types/raf/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}