File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,26 @@ return { props }
3838})"
3939` ;
4040
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+
4161exports [` defineProps > w/ TS assertion 1` ] = `
4262"import { defineComponent as _defineComponent } from 'vue'
4363
Original file line number Diff line number Diff line change @@ -586,6 +586,19 @@ const props = defineProps({ foo: String })
586586 } )
587587 } )
588588
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+
589602 describe ( 'errors' , ( ) => {
590603 test ( 'w/ both type and non-type args' , ( ) => {
591604 expect ( ( ) => {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export function processPropsDestructure(
2828 declId : ObjectPattern
2929) {
3030 if ( ! ctx . options . propsDestructure && ! ctx . options . reactivityTransform ) {
31+ ctx . propsIdentifier = ctx . getString ( declId )
3132 return
3233 }
3334
You can’t perform that action at this time.
0 commit comments