diff --git a/lockfile/lockfile-tests.ts b/lockfile/lockfile-tests.ts new file mode 100644 index 000000000..49aa423d9 --- /dev/null +++ b/lockfile/lockfile-tests.ts @@ -0,0 +1,31 @@ +/// + +import lockfile = require('lockfile'); + +var bool: boolean; +var num: number; +var path: string; + +var opts: lockfile.Options; +var callback: (err: Error) => { + +}; + +opts = { + wait: num, + stale: num, + retries: num, + retryWait: num +}; + +lockfile.lock(path, opts, callback); +lockfile.lock(path, callback); +lockfile.lockSync(path, opts); + +lockfile.unlock(path, callback);; +lockfile.unlockSync(path); + +lockfile.check(path, opts, callback); +lockfile.check(path, callback); + +bool = lockfile.checkSync(path, opts); diff --git a/lockfile/lockfile.d.ts b/lockfile/lockfile.d.ts new file mode 100644 index 000000000..99dfbe28d --- /dev/null +++ b/lockfile/lockfile.d.ts @@ -0,0 +1,24 @@ +// Type definitions for lockfile v0.4.2 +// Project: https://github.com/isaacs/lockfile +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'lockfile' { + export interface Options { + wait?: number; + stale?: number; + retries?: number; + retryWait?: number; + } + + export function lock(path: string, opts: Options, callback: (err: Error) => void): void; + export function lock(path: string, callback: (err: Error) => void): void; + export function lockSync(path: string, opts: Options):void; + + export function unlock(path: string, callback: (err: Error) => void): void; + export function unlockSync(path: string):void; + + export function check(path: string, opts: Options, callback: (err: Error) => void): void; + export function check(path: string, callback: (err: Error) => void): void; + export function checkSync(path: string, opts: Options): boolean; +}