Skip to content

Commit

Permalink
refactor(request): show user-friendly type for c.req.param() (#2780)
Browse files Browse the repository at this point in the history
* refactor(request): show user-friendly type for `c.req.param()`

* chore: denoify
  • Loading branch information
usualoma authored May 24, 2024
1 parent 22a6519 commit d5e7da3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
} from './types'
import { parseBody } from './utils/body'
import type { BodyData, ParseBodyOptions } from './utils/body'
import type { UnionToIntersection } from './utils/types'
import type { Simplify, UnionToIntersection } from './utils/types'
import { getQueryParam, getQueryParams, decodeURIComponent_ } from './utils/url'

type Body = {
Expand Down Expand Up @@ -80,7 +80,7 @@ export class HonoRequest<P extends string = '/', I extends Input['out'] = {}> {
key: P2
): string | undefined
param(key: string): string | undefined
param<P2 extends string = P>(): UnionToIntersection<ParamKeyToRecord<ParamKeys<P2>>>
param<P2 extends string = P>(): Simplify<UnionToIntersection<ParamKeyToRecord<ParamKeys<P2>>>>
param(key?: string): unknown {
return key ? this.getDecodedParam(key) : this.getAllDecodedParams()
}
Expand Down

0 comments on commit d5e7da3

Please sign in to comment.