Skip to content

Commit 8b3e1f0

Browse files
committed
docs: update ts instructions
1 parent 02d8e8b commit 8b3e1f0

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ build({
118118

119119
## Setup
120120

121-
After installing, **you should run your dev server** (usually `npm run dev`) **to generate the first version of the types**. Then you need to add the types to your `tsconfig.json`:
121+
After installing, **you should run your dev server** (usually `npm run dev`) **to generate the first version of the types**. Then you need to add the types to your `tsconfig.json`.
122122

123123
```json
124124
{
@@ -129,9 +129,27 @@ After installing, **you should run your dev server** (usually `npm run dev`) **t
129129
// ...
130130
"compilerOptions": {
131131
// ...
132-
"moduleResolution": "Bundler",
132+
"moduleResolution": "Bundler"
133+
// ...
134+
}
135+
}
136+
```
137+
138+
Then, if you have an `env.d.ts` file like the one created by `npm vue create <my-project>`, add the `unplugin-vue-router/client` types to it:
139+
140+
```ts
141+
// env.d.ts
142+
/// <reference types="vite/client" />
143+
/// <reference types="unplugin-vue-router/client" />
144+
```
145+
146+
If you don't have an `env.d.ts` file, you can create one and add the unplugin-vue-router types to it _or_ you can add them to the `types` property in your `tsconfig.json`:
147+
148+
```json
149+
{
150+
"compilerOptions": {
151+
// ...
133152
"types": [
134-
// ...
135153
"unplugin-vue-router/client"
136154
]
137155
}

0 commit comments

Comments
 (0)