diff --git a/index.d.ts b/index.d.ts index 6cafda6..c9fea9f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -47,16 +47,24 @@ import * as closeWithGrace from 'close-with-grace' }) */ declare function closeWithGrace ( - opts: - | closeWithGrace.CloseWithGraceAsyncCallback - | closeWithGrace.CloseWithGraceCallback - | closeWithGrace.Options + fn: closeWithGrace.CloseWithGraceAsyncCallback +): CloseWithGraceReturn +declare function closeWithGrace ( + fn: closeWithGrace.CloseWithGraceCallback +): CloseWithGraceReturn +declare function closeWithGrace ( + opts: closeWithGrace.Options, + fn: closeWithGrace.CloseWithGraceAsyncCallback ): CloseWithGraceReturn declare function closeWithGrace ( opts: closeWithGrace.Options, - fn?: - | closeWithGrace.CloseWithGraceAsyncCallback - | closeWithGrace.CloseWithGraceCallback + fn: closeWithGrace.CloseWithGraceCallback +): CloseWithGraceReturn +declare function closeWithGrace ( + fn: closeWithGrace.CloseWithGraceAsyncCallback +): CloseWithGraceReturn +declare function closeWithGrace ( + fn: closeWithGrace.CloseWithGraceCallback ): CloseWithGraceReturn -export = closeWithGrace \ No newline at end of file +export = closeWithGrace diff --git a/index.test-d.ts b/index.test-d.ts index 9888749..3f86ef3 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -71,4 +71,12 @@ expectType<{ expectType<{ close: () => void uninstall: () => void -}>(closeWithGrace({ delay: 100 }, AllCallback)) \ No newline at end of file +}>(closeWithGrace({ delay: 100 }, AllCallback)) + +closeWithGrace({ delay: 100 }, async function ({ err }) { + expectType(err) +}) + +closeWithGrace(async function ({ err }) { + expectType(err) +})