[proper-lockfile] Patches options.retries with the correct type (#37313)

* Types options.retries with correct type

`proper-lockfile` is calling `retry.operation()` underneath so the correct type to use
for `LockOptions.retries` is `retry.OperationOptions` and not the more restricted
`retry.TimeoutsOptions`.

* Adds regression test for #37313
This commit is contained in:
Simon Holywell 2019-08-06 06:43:36 +10:00 committed by Nathan Shively-Sanders
parent 0f0adf38ab
commit 64fcb11aae
2 changed files with 5 additions and 2 deletions

View File

@ -6,12 +6,12 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { TimeoutsOptions } from "retry";
import { OperationOptions } from "retry";
export interface LockOptions {
stale?: number; // default: 10000
update?: number; // default: stale/2
retries?: number | TimeoutsOptions; // default: 0
retries?: number | OperationOptions; // default: 0
realpath?: boolean; // default: true
fs?: any; // default: graceful-fs
onCompromised?: (err: Error) => any; // default: (err) => throw err

View File

@ -51,3 +51,6 @@ checkSync('', { lockfilePath: 'some/file-lock' }); // $ExpectType boolean
lock('', { retries: 5 });
lock('', { retries: { retries: 5, factor: 2, minTimeout: 100, randomize: true } });
// regression test for #37313
lock('', { retries: { maxRetryTime: 20, unref: true } });