mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
[proper-lockfile] Add lockfilePath option
This commit is contained in:
parent
351eeb6186
commit
8e9d6c38b7
4
types/proper-lockfile/index.d.ts
vendored
4
types/proper-lockfile/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for proper-lockfile 3.0
|
||||
// Project: https://github.com/moxystudio/node-proper-lockfile
|
||||
// Definitions by: Nikita Volodin <https://github.com/qlonik>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface LockOptions {
|
||||
@ -10,17 +11,20 @@ export interface LockOptions {
|
||||
realpath?: boolean; // default: true
|
||||
fs?: any; // default: graceful-fs
|
||||
onCompromised?: (err: Error) => any; // default: (err) => throw err
|
||||
lockfilePath?: string; // default: `${file}.lock`
|
||||
}
|
||||
|
||||
export interface UnlockOptions {
|
||||
realpath?: boolean; // default: true
|
||||
fs?: any; // default: graceful-fs
|
||||
lockfilePath?: string; // default: `${file}.lock`
|
||||
}
|
||||
|
||||
export interface CheckOptions {
|
||||
stale?: number; // default: 10000
|
||||
realpath?: boolean; // default: true
|
||||
fs?: any; // default: graceful-fs
|
||||
lockfilePath?: string; // default: `${file}.lock`
|
||||
}
|
||||
|
||||
export function lock(file: string, options?: LockOptions): Promise<() => Promise<void>>;
|
||||
|
||||
@ -39,7 +39,12 @@ check('some/file')
|
||||
// isLocked will be true if 'some/file' is locked, false otherwise
|
||||
});
|
||||
|
||||
lock('', { lockfilePath: 'some/file-lock' })
|
||||
.then((release) => release());
|
||||
|
||||
const release = lockSync('some/file'); // $ExpectType () => void
|
||||
release(); // $ExpectType void
|
||||
unlockSync('some/file'); // $ExpectType void
|
||||
unlockSync('', { lockfilePath: 'some/file-lock' }); // $ExpectType void
|
||||
checkSync('some/file'); // $ExpectType boolean
|
||||
checkSync('', { lockfilePath: 'some/file-lock' }); // $ExpectType boolean
|
||||
|
||||
Loading…
Reference in New Issue
Block a user