queckezz / koa-views

Template rendering middleware for koa (hbs, swig, pug, anything! :sparkles:)
MIT License
710 stars 87 forks source link

Type issues after upgrading to koa-views 7.0.0 #155

Closed RuiSiang closed 3 years ago

RuiSiang commented 3 years ago

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

lschricke commented 3 years ago

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

jkhuangfu commented 3 years ago

I'm having the same issue

RuiSiang commented 3 years ago

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.

int64ago commented 3 years ago

Thanks, published via v7.0.1