fix(types): add missing types for `create` and `setBaseURL` (#122)

* fix: add missing types for `create` and `setBaseURL`

* fix: correct `create` return type
master
Daniel Roe 2020-08-21 11:51:38 +01:00 committed by GitHub
parent 9499d0f14b
commit c002aaa97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

11
types/index.d.ts vendored
View File

@ -104,6 +104,12 @@ interface NuxtHTTPInstance {
$delete<T = unknown>(url: Request | URL | string, options?: Options): Promise<T>;
/**
* Set the baseURL for all subsequent requests.
* @param baseURL - the base URL (e.g. `https://myapi.com/`)
*/
setBaseURL(baseURL: string): void
/**
* Set a header on all subsequent requests.
* @param name - Header name.
@ -146,6 +152,11 @@ interface NuxtHTTPInstance {
* This hook enables you to globally handle request errors.
*/
onError(hook: (error: ky.HTTPError) => void): void
/**
* If you need to create your own ky instance which based on $http defaults, you can use the create(options) method.
*/
create(options: Partial<Options>): NuxtHTTPInstance
}
declare module '@nuxt/vue-app' {