Skip to content

Commit 20633bc

Browse files
committed
Simplify init types
Fixes #2443
1 parent 4d7e628 commit 20633bc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

source/types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ export type ExtendOptions = {
6969
mutableDefaults?: boolean;
7070
} & Except<OptionsInit, 'url'>;
7171

72-
type OptionsInitWithoutUrl = Except<OptionsInit, 'url'>;
72+
export type StreamOptions = Except<OptionsInit, 'url'>;
7373

74-
export type StrictOptions = Except<OptionsInitWithoutUrl, 'responseType' | 'resolveBodyOnly'>;
75-
export type StreamOptions = OptionsInitWithoutUrl;
74+
export type StrictOptions = Except<StreamOptions, 'responseType' | 'resolveBodyOnly'>;
7675

77-
export type OptionsWithPagination<T = unknown, R = unknown> = Merge<OptionsInitWithoutUrl, {pagination?: PaginationOptions<T, R>}>;
76+
export type OptionsWithPagination<T = unknown, R = unknown> = Merge<StreamOptions, {pagination?: PaginationOptions<T, R>}>;
7877

7978
/**
8079
An instance of `got.paginate`.
@@ -150,6 +149,7 @@ export type OptionsOfBufferResponseBody = Merge<StrictOptions, {responseType?: '
150149
export type OptionsOfBufferResponseBodyOnly = Merge<StrictOptions, {resolveBodyOnly: true; responseType?: 'buffer'}>;
151150
export type OptionsOfBufferResponseBodyWrapped = Merge<StrictOptions, {resolveBodyOnly: false; responseType?: 'buffer'}>;
152151

152+
// TODO: Remove in the next major version - it's a pure alias for `StrictOptions`.
153153
export type OptionsOfUnknownResponseBody = StrictOptions;
154154
export type OptionsOfUnknownResponseBodyOnly = Merge<StrictOptions, {resolveBodyOnly: true}>;
155155
export type OptionsOfUnknownResponseBodyWrapped = Merge<StrictOptions, {resolveBodyOnly: false}>;
@@ -200,12 +200,12 @@ export type GotRequestFunction<U extends ExtendOptions = Record<string, unknown>
200200
(options: OptionsOfBufferResponseBodyOnly): RequestPromise<Uint8Array<ArrayBuffer>>;
201201

202202
// Fallback
203-
(url: string | URL, options?: OptionsInitWithoutUrl): RequestPromise | Request;
203+
(url: string | URL, options?: StreamOptions): RequestPromise;
204204

205-
(options: OptionsInitWithoutUrl): RequestPromise | Request;
205+
(options: StreamOptions): RequestPromise;
206206

207207
// Internal usage
208-
(url: undefined, options: undefined, defaults: Options): RequestPromise | Request;
208+
(url: undefined, options: undefined, defaults: Options): RequestPromise;
209209
};
210210

211211
/**

0 commit comments

Comments
 (0)