Skip to content

Commit

Permalink
fix(types): add missing types for create and setBaseURL (#122)
Browse files Browse the repository at this point in the history
* fix: add missing types for `create` and `setBaseURL`

* fix: correct `create` return type
  • Loading branch information
danielroe authored Aug 21, 2020
1 parent 9499d0f commit c002aaa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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' {
Expand Down

0 comments on commit c002aaa

Please sign in to comment.