You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/setup.md
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26,3 +26,24 @@ module.exports = {
26
26
}
27
27
}
28
28
```
29
+
30
+
31
+
### Typescript setup
32
+
33
+
Add the types to your "types" array in tsconfig.json after the `@nuxt/vue-app` entry
34
+
35
+
**tsconfig.json**
36
+
37
+
```json
38
+
{
39
+
"compilerOptions": {
40
+
"types": [
41
+
"@nuxt/vue-app",
42
+
"@nuxtjs/axios"
43
+
]
44
+
}
45
+
}
46
+
```
47
+
> **Why?**
48
+
>
49
+
> Because of the way nuxt works the `$axios` property on the context has to be merged into the nuxt `Context` interface via [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Adding `@nuxtjs/axios` to your types will import the types from the package and make typescript aware of the additions to the `Context` interface.
0 commit comments