From 532915ca591dfb363e7d423468b9dabbd62e1bdf Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 13 Jan 2023 08:45:32 -0500 Subject: [PATCH] Fix typings of Shot.inject Without these typescript 4.9 complains when used with `(req, res) => {}` expression and not being able to find the correct type. --- lib/index.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index 23aef90..5c570c9 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -156,9 +156,7 @@ export interface RequestOptions { validate?: boolean; } -type InjectionListener = (req: InjectedRequest, res: ServerResponse) => void; - -type MaybeInjectionListener = (req: MaybeInjectedRequest, res: ServerResponse) => void; +export type InjectionListener = (req: MaybeInjectedRequest, res: ServerResponse) => void; /** * Injects a fake request into an HTTP server. @@ -169,7 +167,6 @@ type MaybeInjectionListener = (req: MaybeInjectedRequest, res: ServerResponse) = * @return A Promise that resolves with a ResponseObject object */ export function inject(dispatchFunc: InjectionListener, options: RequestOptions | string): Promise; -export function inject(dispatchFunc: MaybeInjectionListener, options: RequestOptions | string): Promise; /** * Checks if given object is a Shot Request object.