S
S
Svyatoslav Khusamov2017-04-22 00:01:06
typescript
Svyatoslav Khusamov, 2017-04-22 00:01:06

How can I correctly describe the type for the residual parameters of the function?

I wrote

use(...args: PathParams[] | RequestHandler[] | RequestHandlerParams[])

what got the error
error TS2370: A rest parameter must be of an array type.

How do I correctly specify the type of args?
I don't want to specify like this:
use(...args: (PathParams | RequestHandler | RequestHandlerParams)[])

Because the array should not be interspersed with PathParams | RequestHandler | RequestHandlerParams.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question