File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ type GetSerializedErrorType<ThunkApiConfig> = ThunkApiConfig extends {
177
177
? GetSerializedErrorType
178
178
: SerializedError
179
179
180
- type MaybePromise < T > = T | Promise < T >
180
+ type MaybePromise < T > = T | Promise < T > | ( T extends any ? Promise < T > : never )
181
181
182
182
/**
183
183
* A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`.
Original file line number Diff line number Diff line change @@ -137,6 +137,16 @@ const anyAction = { type: 'foo' } as AnyAction
137
137
expectType < RejectValue > ( unwrapResult ( returned ) )
138
138
} ) ( )
139
139
140
+ /**
141
+ * regression #1156: union return values fall back to allowing only single member
142
+ */
143
+ ; ( async ( ) => {
144
+ const fn = createAsyncThunk ( 'session/isAdmin' , async ( ) => {
145
+ const response : boolean = false
146
+ return response
147
+ } )
148
+ } ) ( )
149
+
140
150
{
141
151
interface Item {
142
152
name : string
You can’t perform that action at this time.
0 commit comments