Skip to content
Myr

Change `Options` and `NormalizedOptions` types back to be `interface`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes #523

authored by Sindre Sorhus · committed by Sindre Sorhus · parent 60e4f67 · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:source/types/options.ts+4 added-4 removed
25 unmodified lines
2627/**28Options are the same as `window.fetch`, with some exceptions.29*/30export type Options = {30export interface Options extends Omit<RequestInit, 'headers'> { // eslint-disable-line @typescript-eslint/consistent-type-definitions -- This must stay an interface so that it can be extended outside of Ky for use in `ky.create`.31 /**32 HTTP method used to make the request.3334 Internally, the standard methods (`GET`, `POST`, `PUT`, `PATCH`, `HEAD` and `DELETE`) are uppercased in order to avoid server errors due to case sensitivity.
185 unmodified lines
220 const json = await ky('https://example.com', {fetch}).json();221 ```222 */223 fetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;224} & Omit<RequestInit, 'headers'>;224}225226export type InternalOptions = Required<227Omit<Options, 'hooks' | 'retry'>,228'credentials' | 'fetch' | 'prefixUrl' | 'timeout'
6 unmodified lines
235236/**237Normalized options passed to the `fetch` call and the `beforeRequest` hooks.238*/239export type NormalizedOptions = {239export interface NormalizedOptions extends RequestInit { // eslint-disable-line @typescript-eslint/consistent-type-definitions -- This must stay an interface so that it can be extended outside of Ky for use in `ky.create`.240 // Extended from `RequestInit`, but ensured to be set (not optional).241 method: RequestInit['method'];242 credentials: RequestInit['credentials'];243244 // Extended from custom `KyOptions`, but ensured to be set (not optional).245 retry: RetryOptions;246 prefixUrl: string;247 onDownloadProgress: Options['onDownloadProgress'];248} & RequestInit;248}249250export type {RetryOptions} from './retry.js';