]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(types): revert jsx global removal (to be removed in 3.4)
authorEvan You <yyx990803@gmail.com>
Tue, 28 Mar 2023 03:17:38 +0000 (11:17 +0800)
committerEvan You <yyx990803@gmail.com>
Tue, 28 Mar 2023 03:17:38 +0000 (11:17 +0800)
CHANGELOG.md
packages/vue/package.json
packages/vue/types/jsx-register.d.ts [new file with mode: 0644]

index b9f06c28826253580aab100ea0034c503b5b8060..ca48762b41f6f25ff296938a3499e4cb8d2dd719 100644 (file)
 * **dx:** improve readability of displayed types for props ([4c9bfd2](https://github.com/vuejs/core/commit/4c9bfd2b999ce472f7481aae4f9dc5bb9f76628e))
 * **types/jsx:** support jsxImportSource, avoid global JSX conflict ([#7958](https://github.com/vuejs/core/issues/7958)) ([d0b7ef3](https://github.com/vuejs/core/commit/d0b7ef3b61d5f83e35e5854b3c2c874e23463102))
 
-### BREAKING CHANGES
+### Note on JSX Types Change
+
+* In the next minor (3.4), Vue no longer registers the global `JSX` namespace by default. This is necessary to avoid global namespace collision with React so that TSX of both libs can co-exist in the same project. This should not affect SFC-only users with latest version of Volar.
 
-* Vue no longer registers the global `JSX` namespace by default. This is necessary to avoid global namespace collision with React so that TSX of both libs can co-exist in the same project. This should not affect SFC-only users with latest version of Volar.
+  For TSX users, it is suggested to set [jsxImportSource](https://www.typescriptlang.org/tsconfig#jsxImportSource) to `'vue'` in `tsconfig.json` after upgrading to 3.3, or opt-in per file with `/* @jsxImportSource vue */`. This will allow you to opt-in to the new behavior now and upgrade seamlessly when 3.4 releases.
 
-  For TSX users, the old global behavior can be enabled by explicitly importing or referencing `vue/jsx`. Alternatively, the user can set [jsxImportSource](https://www.typescriptlang.org/tsconfig#jsxImportSource) to `'vue'` in `tsconfig.json`, or opt-in per file with `/* @jsxImportSource vue */`.
+  If there is code that depends on the presence of the global `JSX` namespace,  you can retain the exact pre-3.4 global behavior by explicitly referencing `vue/jsx`, which registers the global `JSX` namespace.
 
-  Note this is a type-only breaking change in a minor release, which adheres to our [release policy](https://vuejs.org/about/releases.html#semantic-versioning-edge-cases).
+  Note that the planned change in 3.4 is a type-only breaking change in a minor release, which adheres to our [release policy](https://vuejs.org/about/releases.html#semantic-versioning-edge-cases).
 
 # [3.3.0-alpha.4](https://github.com/vuejs/core/compare/v3.3.0-alpha.3...v3.3.0-alpha.4) (2023-02-06)
 
index 72be3e866f3617ae718092a028af42e40dd5146e..900ffe6a1575ba922205f7cd5b238f7c79f084a6 100644 (file)
@@ -48,9 +48,7 @@
       "import": "./jsx-runtime/index.mjs",
       "require": "./jsx-runtime/index.js"
     },
-    "./jsx": {
-      "types": "./jsx.d.ts"
-    },
+    "./jsx": "./jsx.d.ts",
     "./dist/*": "./dist/*",
     "./package.json": "./package.json",
     "./macros": "./macros.d.ts",
diff --git a/packages/vue/types/jsx-register.d.ts b/packages/vue/types/jsx-register.d.ts
new file mode 100644 (file)
index 0000000..a626f79
--- /dev/null
@@ -0,0 +1,4 @@
+// this is appended to the end of ../dist/vue.d.ts during build.
+// imports the global JSX namespace registration for compat.
+// TODO: remove in 3.4
+import '../jsx'