@@ -123,7 +123,7 @@ tester.run('define-props-declaration', rule, {
123
123
` ,
124
124
output : `
125
125
<script setup lang="ts">
126
- const props = defineProps<{ kind: string }>()
126
+ const props = defineProps<{ kind? : string }>()
127
127
</script>
128
128
` ,
129
129
errors : [
@@ -146,7 +146,7 @@ tester.run('define-props-declaration', rule, {
146
146
` ,
147
147
output : `
148
148
<script setup lang="ts">
149
- const props = defineProps<{ kind: string }>()
149
+ const props = defineProps<{ kind? : string }>()
150
150
</script>
151
151
` ,
152
152
errors : [
@@ -168,7 +168,7 @@ tester.run('define-props-declaration', rule, {
168
168
` ,
169
169
output : `
170
170
<script setup lang="ts">
171
- const props = defineProps<{ kind: string }>()
171
+ const props = defineProps<{ kind? : string }>()
172
172
</script>
173
173
` ,
174
174
options : [ 'type-based' ] ,
@@ -191,7 +191,7 @@ tester.run('define-props-declaration', rule, {
191
191
` ,
192
192
output : `
193
193
<script setup lang="ts">
194
- const props = defineProps<{ kind: number }>()
194
+ const props = defineProps<{ kind? : number }>()
195
195
</script>
196
196
` ,
197
197
errors : [
@@ -207,13 +207,13 @@ tester.run('define-props-declaration', rule, {
207
207
code : `
208
208
<script setup lang="ts">
209
209
const props = defineProps({
210
- kind: { type:Boolean}
210
+ kind: { type: Boolean}
211
211
})
212
212
</script>
213
213
` ,
214
214
output : `
215
215
<script setup lang="ts">
216
- const props = defineProps<{ kind: boolean }>()
216
+ const props = defineProps<{ kind? : boolean }>()
217
217
</script>
218
218
` ,
219
219
errors : [
@@ -235,7 +235,7 @@ tester.run('define-props-declaration', rule, {
235
235
` ,
236
236
output : `
237
237
<script setup lang="ts">
238
- const props = defineProps<{ kind: Record<string, any> }>()
238
+ const props = defineProps<{ kind? : Record<string, any> }>()
239
239
</script>
240
240
` ,
241
241
errors : [
@@ -257,7 +257,7 @@ tester.run('define-props-declaration', rule, {
257
257
` ,
258
258
output : `
259
259
<script setup lang="ts">
260
- const props = defineProps<{ kind: any[] }>()
260
+ const props = defineProps<{ kind? : any[] }>()
261
261
</script>
262
262
` ,
263
263
errors : [
@@ -279,7 +279,7 @@ tester.run('define-props-declaration', rule, {
279
279
` ,
280
280
output : `
281
281
<script setup lang="ts">
282
- const props = defineProps<{ kind: (...args: any[]) => any }>()
282
+ const props = defineProps<{ kind? : (...args: any[]) => any }>()
283
283
</script>
284
284
` ,
285
285
errors : [
@@ -301,7 +301,7 @@ tester.run('define-props-declaration', rule, {
301
301
` ,
302
302
output : `
303
303
<script setup lang="ts">
304
- const props = defineProps<{ kind: User }>()
304
+ const props = defineProps<{ kind? : User }>()
305
305
</script>
306
306
` ,
307
307
errors : [
@@ -325,7 +325,7 @@ tester.run('define-props-declaration', rule, {
325
325
` ,
326
326
output : `
327
327
<script setup lang="ts">
328
- const props = defineProps<{ kind: 'a' | 'b' }>()
328
+ const props = defineProps<{ kind? : 'a' | 'b' }>()
329
329
</script>
330
330
` ,
331
331
errors : [
@@ -349,7 +349,7 @@ tester.run('define-props-declaration', rule, {
349
349
` ,
350
350
output : `
351
351
<script setup lang="ts">
352
- const props = defineProps<{ kind: { id: number; name: string } }>()
352
+ const props = defineProps<{ kind? : { id: number; name: string } }>()
353
353
</script>
354
354
` ,
355
355
errors : [
@@ -377,7 +377,7 @@ tester.run('define-props-declaration', rule, {
377
377
<script setup lang="ts">
378
378
interface Kind { id: number; name: string }
379
379
380
- const props = defineProps<{ kind: Kind }>()
380
+ const props = defineProps<{ kind? : Kind }>()
381
381
</script>
382
382
` ,
383
383
errors : [
@@ -405,7 +405,7 @@ tester.run('define-props-declaration', rule, {
405
405
<script setup lang="ts">
406
406
import Kind from 'test'
407
407
408
- const props = defineProps<{ kind: Kind }>()
408
+ const props = defineProps<{ kind? : Kind }>()
409
409
</script>
410
410
` ,
411
411
errors : [
@@ -429,7 +429,7 @@ tester.run('define-props-declaration', rule, {
429
429
` ,
430
430
output : `
431
431
<script setup lang="ts">
432
- const props = defineProps<{ kind: string[] }>()
432
+ const props = defineProps<{ kind? : string[] }>()
433
433
</script>
434
434
` ,
435
435
errors : [
@@ -447,14 +447,13 @@ tester.run('define-props-declaration', rule, {
447
447
const props = defineProps({
448
448
kind: {
449
449
type: Function as PropType<(a: number, b: string) => boolean>,
450
- required: true
451
450
}
452
451
})
453
452
</script>
454
453
` ,
455
454
output : `
456
455
<script setup lang="ts">
457
- const props = defineProps<{ kind: (a: number, b: string) => boolean }>()
456
+ const props = defineProps<{ kind? : (a: number, b: string) => boolean }>()
458
457
</script>
459
458
` ,
460
459
errors : [
@@ -553,7 +552,7 @@ tester.run('define-props-declaration', rule, {
553
552
` ,
554
553
output : `
555
554
<script setup lang="ts">
556
- interface Props { kind: { id: number, name: string } }; const props = defineProps<Props>()
555
+ interface Props { kind? : { id: number, name: string } }; const props = defineProps<Props>()
557
556
</script>
558
557
` ,
559
558
options : [ 'type-based' , { separateInterface : true } ] ,
@@ -578,7 +577,7 @@ tester.run('define-props-declaration', rule, {
578
577
` ,
579
578
output : `
580
579
<script setup lang="ts">
581
- const props = defineProps<{ kind: string | number }>()
580
+ const props = defineProps<{ kind? : string | number }>()
582
581
</script>
583
582
` ,
584
583
errors : [
@@ -602,7 +601,7 @@ tester.run('define-props-declaration', rule, {
602
601
` ,
603
602
output : `
604
603
<script setup lang="ts">
605
- const props = defineProps<{ kind: number | string }>()
604
+ const props = defineProps<{ kind? : number | string }>()
606
605
</script>
607
606
` ,
608
607
errors : [
@@ -626,7 +625,7 @@ tester.run('define-props-declaration', rule, {
626
625
` ,
627
626
output : `
628
627
<script setup lang="ts">
629
- const props = defineProps<{ kind: typeof Test }>()
628
+ const props = defineProps<{ kind? : typeof Test }>()
630
629
</script>
631
630
` ,
632
631
errors : [
0 commit comments