Skip to content

Commit fdb67d1

Browse files
authored
docs: better example to clarify rule (#1984)
1 parent a4e807c commit fdb67d1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: docs/rules/define-props-declaration.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ This rule only works in setup script and `lang="ts"`.
2121
<script setup lang="ts">
2222
/* ✓ GOOD */
2323
const props = defineProps<{
24-
kind: string
24+
kind: string,
25+
options: { title: string }
2526
}>()
2627
2728
/* ✗ BAD */
2829
const props = defineProps({
29-
kind: { type: String }
30+
kind: { type: String },
31+
options: { type: Object as PropType<{ title: string }> }
3032
})
3133
</script>
3234
```
@@ -50,12 +52,14 @@ const props = defineProps({
5052
<script setup lang="ts">
5153
/* ✓ GOOD */
5254
const props = defineProps({
53-
kind: { type: String }
55+
kind: { type: String },
56+
options: { type: Object as PropType<{ title: string }> }
5457
})
5558
5659
/* ✗ BAD */
5760
const props = defineProps<{
58-
kind: string
61+
kind: string,
62+
options: { title: string }
5963
}>()
6064
</script>
6165
```

0 commit comments

Comments
 (0)