Skip to content

[fix] type regression in v15.1.0 #216

@sleewoo

Description

@sleewoo

Describe the bug

Node.js version: v22.21.1

OS version: Linux manjaro 6.12.61-1-MANJARO

Description: Default export is now a constructor, can not use generics anymore.

import type Router from '@koa/router';
// same for `import type { Router } from '@koa/router';`

// this does not work anymore
type MyRouter = Router<AppState, AppContext>;

Actual behavior

//  ■ 'Router' refers to a value, but is being used as a type here. Did you mean 'typeof Router'?
type AppRouter = Router<DefaultState, DefaultContext>; 

Expected behavior

Code to reproduce

Checklist

  • [ x] I have searched through GitHub issues for similar issues.
  • [x ] I have completely read through the README and documentation.
  • [x ] 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