1

Given this:

type params = Parameters<(x: string, y:number)=>void>

In the pseudo code below how does one make fn to be (x: string, y:number)=>void, but using the params type?

type fn = (...params)=>void // type should be (x: string, y:number)=>void

1 Answer 1

2
type fn = (...p: params)=>void

should work. Type the rest parameter with type params.

Playground

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.