mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-01 09:00:11 +00:00
improve form & body functions with conditional types
This commit is contained in:
6
types/got/index.d.ts
vendored
6
types/got/index.d.ts
vendored
@@ -6,7 +6,7 @@
|
||||
// Stijn Van Nieuwenhuyse <https://github.com/stijnvn>
|
||||
// Matthew Bull <https://github.com/wingsbob>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
@@ -95,12 +95,12 @@ declare namespace got {
|
||||
|
||||
interface GotFormFn<T extends string | null> {
|
||||
(url: GotUrl): GotPromise<any>;
|
||||
(url: GotUrl, options: GotFormOptions<T>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotFormOptions<T>): GotPromise<T extends null ? Buffer : string>;
|
||||
}
|
||||
|
||||
interface GotBodyFn<T extends string | null> {
|
||||
(url: GotUrl): GotPromise<any>;
|
||||
(url: GotUrl, options: GotBodyOptions<T>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotBodyOptions<T>): GotPromise<T extends null ? Buffer : string>;
|
||||
}
|
||||
|
||||
type GotInstance<T = GotFn> = T &
|
||||
|
||||
Reference in New Issue
Block a user