From f84a36653e8aadac40eb407fca6865f7b6e46e4d Mon Sep 17 00:00:00 2001 From: Dave Gramlich Date: Sat, 23 Mar 2019 01:53:14 -0700 Subject: [PATCH] Make resolve and reject values optional in the TypeScript definition (#3) --- index.d.ts | 4 ++-- index.test-d.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index f158663..c241a7b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,14 +4,14 @@ export interface DeferredPromise { @param value - The value to resolve the promise with. */ - resolve(value: ValueType | PromiseLike): void; + resolve(value?: ValueType | PromiseLike): void; /** Reject the promise with a provided reason or error. @param reason - The reason or error to reject the promise with. */ - reject(reason: unknown): void; + reject(reason?: unknown): void; /** The deferred promise. diff --git a/index.test-d.ts b/index.test-d.ts index a623865..556cb9b 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -4,6 +4,8 @@ import pDefer, {DeferredPromise} from '.'; expectType>(pDefer()); expectType>(pDefer()); +pDefer().resolve(); pDefer().resolve('foo'); +pDefer().reject(); pDefer().reject(new Error('foo')); expectType>(pDefer().promise);