diff --git a/types/accurate-interval/accurate-interval-tests.ts b/types/accurate-interval/accurate-interval-tests.ts new file mode 100644 index 0000000000..bdf95b56d4 --- /dev/null +++ b/types/accurate-interval/accurate-interval-tests.ts @@ -0,0 +1,13 @@ +import accurateInterval = require('accurate-interval'); + +const interval = accurateInterval(() => void(0), 100, { aligned: true, immediate: true }); +interval.clear(); +const scheduledTime = 1000; +const intervalScheludel = accurateInterval((scheduledTime: number) => void 0, 100, { aligned: true, immediate: true }); +const intervalScheludelError = accurateInterval( + () => { + return void 0; + }, + 100, + { aligned: true, immediate: true }, +); diff --git a/types/accurate-interval/index.d.ts b/types/accurate-interval/index.d.ts new file mode 100644 index 0000000000..f6e8a56f85 --- /dev/null +++ b/types/accurate-interval/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for accurate-interval 1.0 +// Project: https://github.com/klyngbaek/accurate-interval#readme +// Definitions by: Artur Dziedziczak +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function accurateInterval(func: (scheduledTime: number) => void, interval: number, opts: accurateInterval.Opts): accurateInterval.AccurateInterval; +export = accurateInterval; + +declare namespace accurateInterval { + interface Opts { + aligned: boolean; + immediate: boolean; + } + + interface AccurateInterval { + clear: () => void; + } +} diff --git a/types/accurate-interval/tsconfig.json b/types/accurate-interval/tsconfig.json new file mode 100644 index 0000000000..39fc0b45d0 --- /dev/null +++ b/types/accurate-interval/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "accurate-interval-tests.ts" + ] +} diff --git a/types/accurate-interval/tslint.json b/types/accurate-interval/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/accurate-interval/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }