diff --git a/docs/setup.md b/docs/setup.md index 552a3198..de31a74e 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -26,3 +26,24 @@ module.exports = { } } ``` + + +### Typescript setup + +Add the types to your "types" array in tsconfig.json after the `@nuxt/vue-app` entry + +**tsconfig.json** + +```json +{ + "compilerOptions": { + "types": [ + "@nuxt/vue-app", + "@nuxtjs/axios" + ] + } +} +``` +> **Why?** +> +> 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.