Is v27.0.0 specHelper.runAction<T>() generic type variable possible optional? #2003
-
Hi, new feature "specHelper support Action and Task generics" at v27.0.0 is awsome! By the way. specHelper.runAction response(specHelper.ts L34) type is always "UnwrapPromise<A["run"]>". because A(specHelper.ts L18) always extends Action, the conditional ternary operator is useless. actionhero/src/modules/specHelper.ts Lines 18 to 45 in fb09661 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Beta Was this translation helpful? Give feedback.
-
I think the |
Beta Was this translation helpful? Give feedback.
I think you might be asking about overloading the type of the return type of
specHelper.runAction<>()
. In typescript, you can always re-assign a type.Here's the response of a well-typed action, SessionCreate:
I can re-assign the response to, say a boolean if I wanted, but providing
<any>
to the runAction type: