// #8289
test('destructure without enabling reactive destructure', () => {
- const { content } = compile(
+ const { content, bindings } = compile(
`<script setup lang="ts">
const { foo } = defineProps<{
foo: Foo
},
)
expect(content).toMatch(`const { foo } = __props`)
+ expect(content).toMatch(`return { foo }`)
+ expect(bindings).toStrictEqual({
+ foo: BindingTypes.SETUP_CONST,
+ })
assertCode(content)
})
setupBindings,
vueImportAliases,
hoistStatic,
+ !!ctx.propsDestructureDecl,
)
}
bindings: Record<string, BindingTypes>,
userImportAliases: Record<string, string>,
hoistStatic: boolean,
+ isPropsDestructureEnabled = false,
): boolean {
let isAllLiteral = false
}
registerBinding(bindings, id, bindingType)
} else {
- if (isCallOf(init, DEFINE_PROPS)) {
+ if (isCallOf(init, DEFINE_PROPS) && isPropsDestructureEnabled) {
continue
}
if (id.type === 'ObjectPattern') {