Skip to content

Volar breaks @types/react in monorepo when using takeover mode #3355

Closed
@sqal

Description

@sqal

Version

Volar: 1.8.3
TypeScript: 5.1.6

Steps to reproduce

  • Clone https://github.com/sqal/volar-react-types-bug
  • Make sure takeover mode is enabled (@builtin TypeScript and JavaScript Language Features extension is disabled)
  • Install dependencies npm run i
  • Open apps/react-app/src/main.tsx
  • You can run npm run type-check to verify there's no issue in my app

What is actually happening?

I see a lot of Typescript errors reported in my app that I shouldn't see, e.g.

Type 'Element' is not assignable to type 'ReactNode'.

screenshot

What is expected?

No Typescript errors in react-app since all the code is correct.

Any additional comments?

It looks like volar breaks @types/react when I have installed vue somewhere in my monorepo. Follow these steps to verify:

  • Go to apps/vue-app and remove vue from the dependencies
  • cd ../../ & npm i
  • Restart volar's server or restart vscode
  • Now everything works fine in my react-app, there's no issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood reproduction ✨This issue provides a good reproduction, we will be able to investigate it first

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions