You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure how AsyncReturnType is supposed to work. If I try it with a basic async function, that takes a string argument & returns it, I get a type error.
Type '(bar: string) => Promise' does not satisfy the constraint 'AsyncFunction'.
Types of parameters 'bar' and 'args' are incompatible.
Type 'unknown' is not assignable to type 'string'
I've set up a Codesandbox that demonstrates this. I'm not sure what Typescript version it's using, it's not listed in the dependencies, but I am getting it with TS v3.8.2 in my local project.
I'm not sure if there is a specific reason not to use any here, but replacing ...args: unknown[] with ...args: any[] in the AsyncFunction definition resolves the error.
The text was updated successfully, but these errors were encountered:
I'm not sure how
AsyncReturnType
is supposed to work. If I try it with a basicasync
function, that takes a string argument & returns it, I get a type error.I've set up a Codesandbox that demonstrates this. I'm not sure what Typescript version it's using, it's not listed in the dependencies, but I am getting it with TS v3.8.2 in my local project.
I'm not sure if there is a specific reason not to use
any
here, but replacing...args: unknown[]
with...args: any[]
in theAsyncFunction
definition resolves the error.The text was updated successfully, but these errors were encountered: