From ba4b237d1689c73b4e6adfe772300107b3758625 Mon Sep 17 00:00:00 2001 From: ulrichb Date: Tue, 14 May 2019 22:43:36 +0200 Subject: [PATCH] [proper-lockfile] Add `retry` *options * to union (next to `number`) (#35375) * Add `retry` *options * to union (next to `number`) * Update TS version (because of the new "retry" dependency) * Increase the version number * Add definition author --- types/proper-lockfile/index.d.ts | 8 ++++++-- types/proper-lockfile/proper-lockfile-tests.ts | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/proper-lockfile/index.d.ts b/types/proper-lockfile/index.d.ts index 3e49e79fe3..85a5267791 100644 --- a/types/proper-lockfile/index.d.ts +++ b/types/proper-lockfile/index.d.ts @@ -1,13 +1,17 @@ -// Type definitions for proper-lockfile 3.0 +// Type definitions for proper-lockfile 4.1 // Project: https://github.com/moxystudio/node-proper-lockfile // Definitions by: Nikita Volodin // Linus Unnebäck +// ulrichb // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { TimeoutsOptions } from "retry"; export interface LockOptions { stale?: number; // default: 10000 update?: number; // default: stale/2 - retries?: number; // default: 0 + retries?: number | TimeoutsOptions; // default: 0 realpath?: boolean; // default: true fs?: any; // default: graceful-fs onCompromised?: (err: Error) => any; // default: (err) => throw err diff --git a/types/proper-lockfile/proper-lockfile-tests.ts b/types/proper-lockfile/proper-lockfile-tests.ts index 344e7be3f8..a4970ced40 100644 --- a/types/proper-lockfile/proper-lockfile-tests.ts +++ b/types/proper-lockfile/proper-lockfile-tests.ts @@ -48,3 +48,6 @@ unlockSync('some/file'); // $ExpectType void unlockSync('', { lockfilePath: 'some/file-lock' }); // $ExpectType void checkSync('some/file'); // $ExpectType boolean checkSync('', { lockfilePath: 'some/file-lock' }); // $ExpectType boolean + +lock('', { retries: 5 }); +lock('', { retries: { retries: 5, factor: 2, minTimeout: 100, randomize: true } });