-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(types/jsx): support jsxImportSource, avoid global JSX conflict #7958
Conversation
- No longer implicitly register global JSX types by default - This avoid conflict when using Vue in the same project with React - Global registration must now be done by explicitly importing / referencing `vue/jsx`, or listing it in `compilerOptions.types`. - Add `vue/jsx-runtime` to support `jsxImportSource` usage - Can enable globally by setting `compilerOptions.jsxImportSource` to `'vue'` - Can also opt-in per-file with `/** @jsxImportSource vue */`
It’s awesome to see Vue adding support for the JSX automatic runtime! 🎉 I spotted some bugs though. #7959 explains and resolves them. |
Glad to see this! Trying to work with Vue 2.7 (templates only; no JSX/TSX) and React in the same project and dealing with conflicting types when using vue-tsc/Volar. Would it be possible to backport this to 2.7? If not feasible, is there a workaround to have full TS support for both? |
…uejs#7958) - No longer implicitly register global JSX types by default - This avoid conflict when using Vue in the same project with React - Global registration must now be done by explicitly importing / referencing `vue/jsx`, or listing it in `compilerOptions.types`. - Add `vue/jsx-runtime` to support `jsxImportSource` usage - Can enable globally by setting `compilerOptions.jsxImportSource` to `'vue'` - Can also opt-in per-file with `/** @jsxImportSource vue */`
Hi, I have a package vue as dependency to @directus └─┬ @directus/[email protected]
└─┬ [email protected]
└── @vue/[email protected] And I have react projects in Monorepo, currently, I am having build problems because of type conflicts. This issue seems related to me with this merged PR is the issue resolved? Thanks |
@ubeytd Did you find a solution to this ? Having the exact same symptoms on Vue 2.7, monorepo with a project using @react/types... |
In our case, build problems were caused because the package imports |
Based on and supersedes #7083
Closes #1033
Closes #1034
vue/jsx
, or listing it incompilerOptions.types
.vue/jsx-runtime
to supportjsxImportSource
usagecompilerOptions.jsxImportSource
to'vue'
/** @jsxImportSource vue */
Note that global JSX types requires explicit opt-in, which is technically a breaking change, but this is a type-only change and the update path is trivial, so it aligns with the release policy if we release this in a minor.
Update: In 3.3, the JSX types will still be registered globally by default. We plan to remove the global registration in 3.4 while we get IDE support aligned during the 3.3 lifecycle.
This is also needed to land zero-config SFC Generics support in Volar vuejs/language-tools#2546