Skip to content

Commit

Permalink
docs: update ts instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed May 22, 2024
1 parent 02d8e8b commit 8b3e1f0
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ build({

## Setup

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`:
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`.

```json
{
Expand All @@ -129,9 +129,27 @@ After installing, **you should run your dev server** (usually `npm run dev`) **t
// ...
"compilerOptions": {
// ...
"moduleResolution": "Bundler",
"moduleResolution": "Bundler"
// ...
}
}
```

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:

```ts
// env.d.ts
/// <reference types="vite/client" />
/// <reference types="unplugin-vue-router/client" />
```

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`:

```json
{
"compilerOptions": {
// ...
"types": [
// ...
"unplugin-vue-router/client"
]
}
Expand Down

0 comments on commit 8b3e1f0

Please sign in to comment.