Skip to content

Commit

Permalink
chore(client): extract RequestMethod type definition
Browse files Browse the repository at this point in the history
Refactored the `RequestMethod` type definition into a separate declaration to improve code readability and maintainability. This change simplifies the `RequestOptions` interface by referencing the newly extracted `RequestMethod` type, thereby enhancing the clarity and scalability of the type definitions within the `parseRequest.ts` module.
  • Loading branch information
shorwood committed Nov 26, 2024
1 parent 3248ac5 commit 42c62a9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/client/utils/parseRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { parseRequestParameters } from './parseRequestParameters'
import { parseRequestQuery } from './parseRequestQuery'
import { parseRequestUrl } from './parseRequestUrl'

/** The methods to use for the request. */
export type RequestMethod = Lowercase<keyof typeof HttpMethod> | Uppercase<keyof typeof HttpMethod>

/** Headers to include in the request. */
export type RequestHeaders = Partial<Record<MaybeLiteral<HttpHeader>, string>>

Expand All @@ -23,7 +26,7 @@ export type RequestOptions = Override<RequestInit, {
*
* @example 'GET'
*/
method?: Lowercase<keyof typeof HttpMethod> | Uppercase<keyof typeof HttpMethod>
method?: RequestMethod

/**
* The base URL to use for the request. This URL will be used to resolve the
Expand Down

0 comments on commit 42c62a9

Please sign in to comment.