File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export default /*#__PURE__*/_defineComponent({
87
87
88
88
const { foo } = __props
89
89
90
- return { }
90
+ return { foo }
91
91
}
92
92
93
93
})"
Original file line number Diff line number Diff line change @@ -591,7 +591,7 @@ const props = defineProps({ foo: String })
591
591
592
592
// #8289
593
593
test ( 'destructure without enabling reactive destructure' , ( ) => {
594
- const { content } = compile (
594
+ const { content, bindings } = compile (
595
595
`<script setup lang="ts">
596
596
const { foo } = defineProps<{
597
597
foo: Foo
@@ -602,6 +602,10 @@ const props = defineProps({ foo: String })
602
602
} ,
603
603
)
604
604
expect ( content ) . toMatch ( `const { foo } = __props` )
605
+ expect ( content ) . toMatch ( `return { foo }` )
606
+ expect ( bindings ) . toStrictEqual ( {
607
+ foo : BindingTypes . SETUP_CONST ,
608
+ } )
605
609
assertCode ( content )
606
610
} )
607
611
Original file line number Diff line number Diff line change @@ -601,6 +601,7 @@ export function compileScript(
601
601
setupBindings ,
602
602
vueImportAliases ,
603
603
hoistStatic ,
604
+ ! ! ctx . propsDestructureDecl ,
604
605
)
605
606
}
606
607
@@ -1054,6 +1055,7 @@ function walkDeclaration(
1054
1055
bindings : Record < string , BindingTypes > ,
1055
1056
userImportAliases : Record < string , string > ,
1056
1057
hoistStatic : boolean ,
1058
+ isPropsDestructureEnabled = false ,
1057
1059
) : boolean {
1058
1060
let isAllLiteral = false
1059
1061
@@ -1122,7 +1124,7 @@ function walkDeclaration(
1122
1124
}
1123
1125
registerBinding ( bindings , id , bindingType )
1124
1126
} else {
1125
- if ( isCallOf ( init , DEFINE_PROPS ) ) {
1127
+ if ( isCallOf ( init , DEFINE_PROPS ) && isPropsDestructureEnabled ) {
1126
1128
continue
1127
1129
}
1128
1130
if ( id . type === 'ObjectPattern' ) {
You can’t perform that action at this time.
0 commit comments