0
votes

I'm using koa with Typescript. I also use the koa middleware koa-static and koa-bodyparser. I have the type definition packages @types/koa, @types/koa-bodyparser and @types/koa-static installed. When I run tsc I get the following errors:

ERROR in [default] ./node_modules/@types/koa-bodyparser/index.d.ts:69:8 Namespace 'Koa' has no exported member 'Middleware'.

and

ERROR in [default] ./node_modules/@types/koa-static/index.d.ts:45:8 Namespace 'Koa' has no exported member 'Middleware'.

I doubt this error has anything to do with my own code. Any help appreciated.

1

1 Answers

0
votes

After digging around I found this merged pull request https://github.com/DefinitelyTyped/DefinitelyTyped/pull/13447. This had me check my current installed type definitions. I found that the current version of @types/koa (0.0.0) does not yet export the required Middleware member that the newer versions of @types/koa-bodyparser (3.0.23) and @types/koa-static (2.0.22) is looking for. Revert their versions back to 3.0.20 and 2.0.21 respectively.