File tree 3 files changed +34
-0
lines changed
3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,26 @@ return { props }
38
38
})"
39
39
` ;
40
40
41
+ exports [` defineProps > destructure without enabling reactive destructure 1` ] = `
42
+ "import { defineComponent as _defineComponent } from 'vue'
43
+
44
+ export default /*#__PURE__*/_defineComponent({
45
+ props : {
46
+ foo: { type: null , required: true }
47
+ },
48
+ setup (__props : any , { expose: __expose }) {
49
+ __expose();
50
+
51
+ const { foo } = __props ;
52
+
53
+
54
+
55
+ return { }
56
+ }
57
+
58
+ })"
59
+ ` ;
60
+
41
61
exports [` defineProps > w/ TS assertion 1` ] = `
42
62
"import { defineComponent as _defineComponent } from 'vue'
43
63
Original file line number Diff line number Diff line change @@ -586,6 +586,19 @@ const props = defineProps({ foo: String })
586
586
} )
587
587
} )
588
588
589
+ // #8289
590
+ test ( 'destructure without enabling reactive destructure' , ( ) => {
591
+ const { content } = compile (
592
+ `<script setup lang="ts">
593
+ const { foo } = defineProps<{
594
+ foo: Foo
595
+ }>()
596
+ </script>`
597
+ )
598
+ expect ( content ) . toMatch ( `const { foo } = __props` )
599
+ assertCode ( content )
600
+ } )
601
+
589
602
describe ( 'errors' , ( ) => {
590
603
test ( 'w/ both type and non-type args' , ( ) => {
591
604
expect ( ( ) => {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function processPropsDestructure(
28
28
declId : ObjectPattern
29
29
) {
30
30
if ( ! ctx . options . propsDestructure && ! ctx . options . reactivityTransform ) {
31
+ ctx . propsIdentifier = ctx . getString ( declId )
31
32
return
32
33
}
33
34
You can’t perform that action at this time.
0 commit comments