This repository was archived by the owner on Dec 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +39
-5
lines changed Expand file tree Collapse file tree 3 files changed +39
-5
lines changed Original file line number Diff line number Diff line change @@ -220,9 +220,6 @@ export function applyMacros(nodes: Statement[]) {
220
220
221
221
return t . objectExpression (
222
222
Object . entries ( props ) . map ( ( [ key , value ] ) => {
223
- if ( value . type === 'null' )
224
- return t . objectProperty ( t . identifier ( key ) , t . nullLiteral ( ) )
225
-
226
223
const prop = hasStaticDefaults
227
224
? ( propsRuntimeDefaults as ObjectExpression ) . properties . find ( ( node : any ) => node . key . name === key ) as ObjectProperty
228
225
: undefined
Original file line number Diff line number Diff line change @@ -369,7 +369,11 @@ __sfc_main.props = {
369
369
required: false ,
370
370
type: Array
371
371
},
372
- any : null
372
+ any : {
373
+ key: \\" any\\ " ,
374
+ required: true ,
375
+ type: null
376
+ }
373
377
} ;
374
378
375
379
__sfc_main.setup = (__props, __ctx) => {
@@ -426,6 +430,28 @@ export default __sfc_main;
426
430
"
427
431
`;
428
432
433
+ exports[`transform fixtures test/fixtures/MacrosType4.vue 1`] = `
434
+ " <script lang =\\"ts\\">
435
+ type Test = number[];
436
+ const __sfc_main = { } ;
437
+ __sfc_main.props = {
438
+ test : {
439
+ key: \\" test\\ " ,
440
+ required: false ,
441
+ type: null ,
442
+ default : () => []
443
+ }
444
+ } ;
445
+
446
+ __sfc_main.setup = (__props, __ctx) => {
447
+ return {};
448
+ } ;
449
+
450
+ export default __sfc_main;
451
+ </script>
452
+ "
453
+ `;
454
+
429
455
exports[`transform fixtures test/fixtures/MacrosTypeAny.vue 1`] = `
430
456
" <template>
431
457
<div>
@@ -436,7 +462,11 @@ exports[`transform fixtures test/fixtures/MacrosTypeAny.vue 1`] = `
436
462
<script lang =\\"ts\\">
437
463
const __sfc_main = { } ;
438
464
__sfc_main.props = {
439
- value : null
465
+ value : {
466
+ key: \\" value\\ " ,
467
+ required: true ,
468
+ type: null
469
+ }
440
470
} ;
441
471
442
472
__sfc_main.setup = (__props, __ctx) => {
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ type Test = number []
3
+ withDefaults (
4
+ defineProps <{ test: Test }>(),
5
+ { test: () => [] },
6
+ )
7
+ </script >
You can’t perform that action at this time.
0 commit comments