Costa.
TTCTheo's Typesafe Cult
•Created by Costa. on 4/10/2023 in #questions
Use function as a parameter and preserve types
Hey guys, i'm trying to figure out a way to do the following
I have and interface with some functions/promises
Is there a way the create a function wrapper with the parameter is a function of
SomeInterface
and the return type is the parameter of this function. Something like this:
Then i would do this:
wrapper(foo(...args)) ✅
wrapper(wrong(...args)) ❌
I still a noob in typescript, so i'd be happy if someone help me ❤️32 replies