queckezz/koa-views

Type issues after upgrading to koa-views 7.0.0

RuiSiang opened this issue · 4 comments

After upgrading to koa-views 7.0.0, I'm getting typescript errors. It was fine in version 6

Pipeline: https://github.com/RuiSiang/PoW-Shield/runs/2066999278?check_suite_focus=true
Error TS2345: Argument of type 'Function' is not assignable to parameter of type 'Middleware<DefaultState, DefaultContext, any>'.
File: https://github.com/RuiSiang/PoW-Shield/blob/main/app.ts

Snippet of the code that resulted in error (lines 38 to 42)

app.use(
  views(__dirname + '/views', {
    extension: 'pug',
  })
)

The only temporary workaround that I can think of is either changing import to require on koa-view(that fixes the issue since the error is due to TS) or simply setting an upper limit in package-lock to prevent upgrading to 7.0.0. Any normal fixes are really needed, I've been trying to fix it for a few days. Any help is appreciated.

Thanks

Hi, thanks for the work on this lib! 👍
Just to mention that I'm having the same issue.

I'm having the same issue

I've fixed it and opened PR #156 , you guys can manually build and use it for the time being. Dunno how long it'll take for them to merge it.

Thanks, published via v7.0.1