Why does `BaseContext.render` have to return `void` ?
entyo opened this issue · comments
e_ntyo commented
I am trying to use koa-pug@v4.0.3 with TypeScript@^3.2
Please tell me the reason why the return type of BaseContext.render
is not Promise<void>
but void
? Due to the declaration merging at here,
declare module 'koa' {
export interface BaseContext {
render: (tpl: string, locals?: any, options?: RenderOptions, noCache?: boolean) => void
}
}
I receive some lint violations from ESLint when I try to call render
method of ctx
.
ctx.status = 404;
await ctx.render('4xx.pug');
error Unexpected
await
of a non-Promise (non-"Thenable") value @typescript-eslint/await-thenable`
Chris Yip commented
Fixed in 4.0.4.
Thank you.