Skip to content

Commit 4af5d1b

Browse files
committed
feat(sfc): revert withDefaults() deprecation
In some cases, the user still needs access to the full props object, in such cases withDefaults() is still needed.
1 parent f597146 commit 4af5d1b

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
* **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))
3636
* **compiler-sfc:** add defineOptions macro ([#5738](https://github.com/vuejs/core/issues/5738)) ([bcf5841](https://github.com/vuejs/core/commit/bcf5841ddecc64d0bdbd56ce1463eb8ebf01bb9d))
37-
* **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))
37+
* **compiler-sfc:** enable reactive props destructure by default ([#7986](https://github.com/vuejs/core/issues/7986)) ([ba9c2ae](https://github.com/vuejs/core/commit/ba9c2ae247fcc3960b238a04cb635158daa82004))
3838
* **compiler-sfc:** improve runtime props inference for enum ([eded947](https://github.com/vuejs/core/commit/eded94712e37856f258dc8c85f98a26fa41ae05f))
3939
* **compiler-sfc:** support generating variable instead of default export in compileScript ([71635be](https://github.com/vuejs/core/commit/71635be68d25887f91d624bb7f78281a851bc0cb))
4040
* **compiler-sfc:** support module string names syntax ([#7428](https://github.com/vuejs/core/issues/7428)) ([0002567](https://github.com/vuejs/core/commit/000256772816d54976e462330a7be342c49c7304))

packages/compiler-sfc/src/compileScript.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function compileScript(
162162
): SFCScriptBlock {
163163
let { script, scriptSetup, source, filename } = sfc
164164
// feature flags
165-
// TODO remove support for deprecated options when out of experimental
165+
// TODO remove in 3.4
166166
const enableReactivityTransform = !!options.reactivityTransform
167167
const isProd = !!options.isProd
168168
const genSourceMap = options.sourceMap !== false
@@ -524,11 +524,6 @@ export function compileScript(
524524
if (!isCallOf(node, WITH_DEFAULTS)) {
525525
return false
526526
}
527-
warnOnce(
528-
`withDefaults() has been deprecated. ` +
529-
`Props destructure is now reactive by default - ` +
530-
`use destructure with default values instead.`
531-
)
532527
if (processDefineProps(node.arguments[0], declId)) {
533528
if (propsRuntimeDecl) {
534529
error(

packages/runtime-core/src/apiSetupHelpers.ts

-2
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ type PropsWithDefaults<Base, Defaults> = Base & {
232232
*
233233
* This is only usable inside `<script setup>`, is compiled away in the output
234234
* and should **not** be actually called at runtime.
235-
*
236-
* @deprecated use reactive props destructure instead.
237235
*/
238236
export function withDefaults<Props, Defaults extends InferDefaults<Props>>(
239237
props: Props,

0 commit comments

Comments
 (0)