Even though AsyncActionCreatorBuilder can be easily used by providing set and fixed types, it can't be used when trying to retrieve generics.
Mandatory info
[x] Did you checked compatibility notes and migration guides?
How to Reproduce
function asyncActionEnhancer<
TRequestType,
TRequestValue,
TResponseType,
TResponseValue,
TError
>(
asyncAction: AsyncActionCreatorBuilder<
[TRequestType, TRequestValue],
[TResponseType, TResponseValue],
[TError, Error]
>
): TRequestValue {
/** Logic here */
}
Current behaviour
TS shows an error on the line [TRequestType, TRequestValue]:
Type 'TRequestValue' is not assignable to type '[TRequestType, TRequestValue] extends [TRequestType, [any, any]] ? ([any, any] & TRequestValue)[0] : TRequestValue'.
Expected behaviour
TS should be able to infer the function generics from asyncAction
Suggested solution(s)
It already worked previously in v4 with the type AsyncActionCreator from src/create-async-action, which was typed with much less type constraints than the currentAsyncActionCreatorBuilder
Description
Even though AsyncActionCreatorBuilder can be easily used by providing set and fixed types, it can't be used when trying to retrieve generics.
Mandatory info
How to Reproduce
Current behaviour
TS shows an error on the line
[TRequestType, TRequestValue]
:Expected behaviour
TS should be able to infer the function generics from
asyncAction
Suggested solution(s)
It already worked previously in v4 with the type
AsyncActionCreator
fromsrc/create-async-action
, which was typed with much less type constraints than the currentAsyncActionCreatorBuilder
Project Dependencies