0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-29 01:32:12 +01:00

fix(context): remove duplicate definition of render method (#2191)

* fix(context): remove duplicate definition of render method

The `render` method was defined twice in the `Context` class.
This duplicate definition was causing a TypeScript error below if `tsc` is used to compile the project:

```
node_modules/hono/dist/types/context.d.ts(134,5): error TS2300: Duplicate identifier 'render'.
```

* chore: denoify
This commit is contained in:
Taku Amano 2024-02-11 11:06:02 +09:00 committed by GitHub
parent ca6f365110
commit c62556ae06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 22 deletions

View File

@ -209,10 +209,10 @@ export class Context<
* ```
* @see https://hono.dev/api/context#render-setrenderer
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-explicit-any
render: Renderer = (...args: any[]) => this.renderer(...args)
render: Renderer = (...args) => this.renderer(...args)
setLayout = (layout: FC<PropsForRenderer & { Layout: FC }>) => (this.layout = layout)
getLayout = () => this.layout
/**
* `.setRenderer()` can set the layout in the custom middleware.
@ -233,13 +233,6 @@ export class Context<
* ```
* @see https://hono.dev/api/context#render-setrenderer
*/
// @ts-expect-error It is unknown how many arguments the renderer will receive.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
render: Renderer = (...args: any[]) => this.renderer(...args)
setLayout = (layout: FC<PropsForRenderer & { Layout: FC }>) => (this.layout = layout)
getLayout = () => this.layout
setRenderer = (renderer: Renderer) => {
this.renderer = renderer
}

View File

@ -209,10 +209,10 @@ export class Context<
* ```
* @see https://hono.dev/api/context#render-setrenderer
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-explicit-any
render: Renderer = (...args: any[]) => this.renderer(...args)
render: Renderer = (...args) => this.renderer(...args)
setLayout = (layout: FC<PropsForRenderer & { Layout: FC }>) => (this.layout = layout)
getLayout = () => this.layout
/**
* `.setRenderer()` can set the layout in the custom middleware.
@ -233,13 +233,6 @@ export class Context<
* ```
* @see https://hono.dev/api/context#render-setrenderer
*/
// @ts-expect-error It is unknown how many arguments the renderer will receive.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
render: Renderer = (...args: any[]) => this.renderer(...args)
setLayout = (layout: FC<PropsForRenderer & { Layout: FC }>) => (this.layout = layout)
getLayout = () => this.layout
setRenderer = (renderer: Renderer) => {
this.renderer = renderer
}