]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(sfc): revert withDefaults() deprecation
authorEvan You <yyx990803@gmail.com>
Fri, 31 Mar 2023 00:53:15 +0000 (08:53 +0800)
committerEvan You <yyx990803@gmail.com>
Fri, 31 Mar 2023 00:53:15 +0000 (08:53 +0800)
In some cases, the user still needs access to the full props object,
in such cases withDefaults() is still needed.

CHANGELOG.md
packages/compiler-sfc/src/compileScript.ts
packages/runtime-core/src/apiSetupHelpers.ts

index e5b70cbf6a27d7fffa27c2fb3db16e63e068039b..ad42a00eccbaae6284170131a1edf10b04eeef86 100644 (file)
@@ -34,7 +34,7 @@
 
 * **compiler-core:** support parsing `const` modifier in type parameters ([#7912](https://github.com/vuejs/core/issues/7912)) ([b7bd50f](https://github.com/vuejs/core/commit/b7bd50f5059e8755c0204f01a8c55b1724688e7e))
 * **compiler-sfc:** add defineOptions macro ([#5738](https://github.com/vuejs/core/issues/5738)) ([bcf5841](https://github.com/vuejs/core/commit/bcf5841ddecc64d0bdbd56ce1463eb8ebf01bb9d))
-* **compiler-sfc:** enable reactive props destructure by default and deprecate withDefaults() ([#7986](https://github.com/vuejs/core/issues/7986)) ([ba9c2ae](https://github.com/vuejs/core/commit/ba9c2ae247fcc3960b238a04cb635158daa82004))
+* **compiler-sfc:** enable reactive props destructure by default ([#7986](https://github.com/vuejs/core/issues/7986)) ([ba9c2ae](https://github.com/vuejs/core/commit/ba9c2ae247fcc3960b238a04cb635158daa82004))
 * **compiler-sfc:** improve runtime props inference for enum ([eded947](https://github.com/vuejs/core/commit/eded94712e37856f258dc8c85f98a26fa41ae05f))
 * **compiler-sfc:** support generating variable instead of default export in compileScript ([71635be](https://github.com/vuejs/core/commit/71635be68d25887f91d624bb7f78281a851bc0cb))
 * **compiler-sfc:** support module string names syntax ([#7428](https://github.com/vuejs/core/issues/7428)) ([0002567](https://github.com/vuejs/core/commit/000256772816d54976e462330a7be342c49c7304))
index ef287a0a8fbfbd15e19d1760a6536af86007dbc5..cb9e4860126cfe6399b609a1c3f6808298c20d59 100644 (file)
@@ -162,7 +162,7 @@ export function compileScript(
 ): SFCScriptBlock {
   let { script, scriptSetup, source, filename } = sfc
   // feature flags
-  // TODO remove support for deprecated options when out of experimental
+  // TODO remove in 3.4
   const enableReactivityTransform = !!options.reactivityTransform
   const isProd = !!options.isProd
   const genSourceMap = options.sourceMap !== false
@@ -524,11 +524,6 @@ export function compileScript(
     if (!isCallOf(node, WITH_DEFAULTS)) {
       return false
     }
-    warnOnce(
-      `withDefaults() has been deprecated. ` +
-        `Props destructure is now reactive by default - ` +
-        `use destructure with default values instead.`
-    )
     if (processDefineProps(node.arguments[0], declId)) {
       if (propsRuntimeDecl) {
         error(
index 91f4e39e32e1f3c80e897e5c125bb8e180e06c43..31307aa7e75d49f36d254581d6e6db2f5ce7d7db 100644 (file)
@@ -232,8 +232,6 @@ type PropsWithDefaults<Base, Defaults> = Base & {
  *
  * This is only usable inside `<script setup>`, is compiled away in the output
  * and should **not** be actually called at runtime.
- *
- * @deprecated use reactive props destructure instead.
  */
 export function withDefaults<Props, Defaults extends InferDefaults<Props>>(
   props: Props,