Skip to content

[fix] middleware use type regression in v15.2.0 #219

@zivni

Description

@zivni

Describe the bug

Node.js version: 24.12.0

OS version: linux

Description: adding an array of middlewares causes a typescript error.

const middlewares?: Array<RouterMiddleware>=...
router.use(...middlewares) //used to work in old version. 
router.use(middlewares[0],middlewares[1], ...middlewares) //this works

the old type definition was

  use(...middleware: Array<Router.Middleware<StateT, ContextT>>): Router<StateT, ContextT>;

Actual behavior

Expected behavior

no Error for router.use(...middlewares)

Code to reproduce

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions