add lint for deasync

This commit is contained in:
Sicilica
2017-07-19 14:56:24 -06:00
parent 788200b3f4
commit 7aac62aceb
4 changed files with 22 additions and 24 deletions
+10 -14
View File
@@ -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);
+7 -9
View File
@@ -1,16 +1,14 @@
// Type definitions for deasync
// Type definitions for deasync 0.1
// Project: https://github.com/abbr/deasync
// Definitions by: Matt Rollins <https://github.com/Sicilica>
// 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
+1 -1
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "dtslint/dt.json",
"rules": {}
}