Skip to content

Commit eca7298

Browse files
IlyaSemenovpi0
authored andcommitted
fest: add typescript definitions (#143)
fixes #19 and #75.
1 parent dee0087 commit eca7298

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

index.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { AxiosInstance, AxiosRequestConfig, AxiosPromise } from 'axios'
2+
import Vue from 'vue'
3+
4+
interface NuxtAxiosInstance extends AxiosInstance {
5+
$request<T = any>(config: AxiosRequestConfig): AxiosPromise<T>
6+
$get<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>
7+
$delete<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>
8+
$head<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>
9+
$options<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>
10+
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>
11+
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>
12+
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>
13+
}
14+
15+
declare module 'vue/types/vue' {
16+
interface Vue {
17+
$axios: NuxtAxiosInstance
18+
}
19+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Secure and easy axios integration with Nuxt.js",
55
"license": "MIT",
66
"main": "lib/module.js",
7+
"types": "index.d.ts",
78
"repository": "https://github.com/nuxt-community/axios-module",
89
"publishConfig": {
910
"access": "public"

0 commit comments

Comments
 (0)