T
T
t800zippygod2021-07-11 16:35:26
typescript
t800zippygod, 2021-07-11 16:35:26

How to prescribe types to link them with library code?

Good day!
I have a library, one of whose functions takes, for example, such a parameter (... handlers: >).
I am writing a wrapper for more convenient interaction with the library code. I need to create a function that will accept parameters in a form that is convenient for me and pass the execution into a library function.
Here the question arises: how to correctly type my function?
Probably a stupid question, but I can't seem to find a solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-07-11
@t800zippygod

Need a code. The question is too abstract. (or you didn't wrap the code in a tag <code></code>:) )
Get the type from an existing function: . Get the type of parameters passed to the function and the type of the return value: and respectively. For complex types with generics - you need to look separately. type Fuc = typeof func;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question