From 464b61dc6d5cebbb88b08cfd0bc31c8d1048e6b4 Mon Sep 17 00:00:00 2001 From: Miyamoto Date: Sat, 6 Jul 2019 22:55:25 +0200 Subject: [PATCH] #248 Add union overload to ThunkDispatch (#255) * #248 Add union overload to ThunkDispatch See discussion in #248 and https://github.com/microsoft/TypeScript/issues/14107. Without this explicit overload, TypeScript is unable to figure out that the function can be called with an argument of type `T|ThunkAction<...>`. * Merge ThunkDispatch union overload with renamed type parameters Co-Authored-By: Tim Dorr --- index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.d.ts b/index.d.ts index bac521a..3c69133 100644 --- a/index.d.ts +++ b/index.d.ts @@ -26,6 +26,12 @@ export interface ThunkDispatch< thunkAction: ThunkAction ): TReturnType; (action: A): A; + // This overload is the union of the two above (see TS issue #14107). + ( + action: + | TAction + | ThunkAction + ): TAction | TReturnType; } /**