ReturnType
Like the builtin helper but more convenient to use.
There is two major pain point with the default ReturnType:
Used with async function
If you have a function like:
And you are trying to extract Shape
, when you use the default return type:
With tsafe
's ReturnType
Used with function that can be undefined
undefined
Let's say we have an interface defined as such:
And we want to extract the type Shape
, using the default ReturnType
we have to do:
With the ReturnType of tsafe
you don't need NonNullable
Last updated