diff --git a/types/deasync/deasync-tests.ts b/types/deasync/deasync-tests.ts index fb2761d566..e4e77561e9 100644 --- a/types/deasync/deasync-tests.ts +++ b/types/deasync/deasync-tests.ts @@ -1,28 +1,24 @@ -import * as deasync from "deasync" - - +import * as deasync from "deasync"; function asyncFunction(input: number, cb: (res: number) => void) {} function handle(res: number) {} - - // base case -asyncFunction(42, handle) +asyncFunction(42, handle); // deasync -let wrapped = deasync(asyncFunction) -handle(wrapped(42)) +let wrapped = deasync(asyncFunction); +handle(wrapped(42)); // deasync.loopWhile -let done = false +let done = false; asyncFunction(42, () => { - done = true -}) -deasync.loopWhile(() => !done) + done = true; +}); +deasync.loopWhile(() => !done); // deasync.runLoopOnce -deasync.runLoopOnce() +deasync.runLoopOnce(); // deasync.sleep -deasync.sleep(100) +deasync.sleep(100); diff --git a/types/deasync/index.d.ts b/types/deasync/index.d.ts index c87760c49b..20440203e7 100644 --- a/types/deasync/index.d.ts +++ b/types/deasync/index.d.ts @@ -1,16 +1,14 @@ -// Type definitions for deasync +// Type definitions for deasync 0.1 // Project: https://github.com/abbr/deasync // Definitions by: Matt Rollins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -declare function deasync(func: (...pn: any[])=>void): (...pn: any[])=>any; +export = deasync; + +declare function deasync(fn: (...args: any[]) => void): (...args: any[]) => any; declare namespace deasync { - - export function loopWhile(predicate: ()=>boolean): void - export function runLoopOnce(): void - export function sleep(ms: number): void - + function loopWhile(pred: () => boolean): void; + function runLoopOnce(): void; + function sleep(ms: number): void; } - -export = deasync diff --git a/types/deasync/tsconfig.json b/types/deasync/tsconfig.json index 08469db6f6..5b96318954 100644 --- a/types/deasync/tsconfig.json +++ b/types/deasync/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/deasync/tslint.json b/types/deasync/tslint.json new file mode 100644 index 0000000000..c6c6df5352 --- /dev/null +++ b/types/deasync/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "dtslint/dt.json", + "rules": {} +}