Skip to content

Commit 4d63a21

Browse files
committedSep 5, 2023
Change Options and NormalizedOptions types back to be interface
Fixes #523
1 parent 60e4f67 commit 4d63a21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎source/types/options.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type KyHeadersInit = HeadersInit | Record<string, string | undefined>;
2727
/**
2828
Options are the same as `window.fetch`, with some exceptions.
2929
*/
30-
export type Options = {
30+
export 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`.
3131
/**
3232
HTTP method used to make the request.
3333
@@ -221,7 +221,7 @@ export type Options = {
221221
```
222222
*/
223223
fetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
224-
} & Omit<RequestInit, 'headers'>;
224+
}
225225

226226
export type InternalOptions = Required<
227227
Omit<Options, 'hooks' | 'retry'>,
@@ -236,7 +236,7 @@ Omit<Options, 'hooks' | 'retry'>,
236236
/**
237237
Normalized options passed to the `fetch` call and the `beforeRequest` hooks.
238238
*/
239-
export type NormalizedOptions = {
239+
export 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`.
240240
// Extended from `RequestInit`, but ensured to be set (not optional).
241241
method: RequestInit['method'];
242242
credentials: RequestInit['credentials'];
@@ -245,6 +245,6 @@ export type NormalizedOptions = {
245245
retry: RetryOptions;
246246
prefixUrl: string;
247247
onDownloadProgress: Options['onDownloadProgress'];
248-
} & RequestInit;
248+
}
249249

250250
export type {RetryOptions} from './retry.js';

0 commit comments

Comments
 (0)
Please sign in to comment.