Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does BaseContext.render have to return void ? #31

Closed
entyo opened this issue May 28, 2020 · 1 comment
Closed

Why does BaseContext.render have to return void ? #31

entyo opened this issue May 28, 2020 · 1 comment

Comments

@entyo
Copy link

entyo commented May 28, 2020

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`

@chrisyip
Copy link
Owner

Fixed in 4.0.4.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants