Skip to content

Commit

Permalink
Fix got.mergeOptions(...) types (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper authored and sindresorhus committed Dec 6, 2019
1 parent 22e72c8 commit b962d08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/create.ts
@@ -1,4 +1,4 @@
import {Merge, PartialDeep} from 'type-fest';
import {Merge} from 'type-fest';
import asPromise from './as-promise';
import asStream, {ProxyStream} from './as-stream';
import * as errors from './errors';
Expand Down Expand Up @@ -70,7 +70,7 @@ export interface Got extends Record<HTTPAlias, GotFunctions>, GotFunctions {

extend(...instancesOrOptions: Array<Got | ExtendOptions>): Got;
mergeInstances(parent: Got, ...instances: Got[]): Got;
mergeOptions<T extends PartialDeep<Options>>(...sources: T[]): T;
mergeOptions(...sources: Options[]): NormalizedOptions;
}

export interface GotStream extends Record<HTTPAlias, ReturnStream> {
Expand Down
11 changes: 11 additions & 0 deletions test/normalize-arguments.ts
@@ -0,0 +1,11 @@
import test from 'ava';
import got from '../source';

test('should merge options replacing responseType', t => {
const responseType = 'json';
const options = got.mergeOptions(got.defaults.options, {
responseType
});

t.is(options.responseType, responseType);
});

0 comments on commit b962d08

Please sign in to comment.