Skip to content

Commit

Permalink
docs: how to prevent issues related to @types/react (#764)
Browse files Browse the repository at this point in the history
fixes #552
fixes #568
  • Loading branch information
mesqueeb authored Dec 8, 2021
1 parent 6954dc5 commit f42d7fd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ See [Vue Language Features#Using](https://github.com/johnsoncodehk/volar/tree/ma

See [Vue Language Features#Note](https://github.com/johnsoncodehk/volar/tree/master/extensions/vscode-vue-language-features#note)

## FAQ

Q) VSCode gives an error for `class` and `slot` with Volar, is Volar broken?

<kbd><img width="483" src="https://user-images.githubusercontent.com/3253920/145134536-7bb090e9-9dcd-4a61-8096-3c47d6c1a699.png" /></kbd>

A) This is because one of the packages installed in your project uses `@types/react` which breaks some parts of Volar. It can however easily be solved like so:

1. in your project (or monorepo) root folder add a folder called `stub/types__react`
2. in there create a file called `index.d.ts`
3. save this as the content of the file: `export {}`
4. add this to your project (or monorepo) root `package.json`:
```
"@types/react": "file:stub/types__react",
```
5. Now install dependencies (`npm i` / `yarn`) and restart VSCode, and the problem should be fixed. 🎉

## Limitations

- Due to performance, *.ts content update don't update template diagnosis for now. ([#565](https://github.com/johnsoncodehk/volar/issues/565)) (Block by [microsoft/TypeScript#41051](https://github.com/microsoft/TypeScript/issues/41051))
Expand Down

0 comments on commit f42d7fd

Please sign in to comment.