Best practices - defining types when lib doesn't export the type
I'm writing a hook that wraps a transaction from another library.
The library returns a Promise<SendTransactionResult>, but SendTransactoinResult is not exported from the library.
I'm writing a handler for the promise but I'm struggling with what the best practice would be for defining the type that this callback should expect.
How would you handle this?
3 Replies
I found
Awaited<ReturnType<typeof writeAsync>>
, but it's throwing a type error:
So, writeAsync
can either be a function, or undefined, and the type error is complaining that it can't infer the return type of undefined since it's not a function.
Any suggestions on how I would gate that so I can get the result assuming it's not undefined?Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks! I'll give this a shot.