Skip to content

Commit 467e85f

Browse files
authored
docs: improve example to better clarify rule (#1985)
1 parent fdb67d1 commit 467e85f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const emit = defineEmits<{
2525
(e: 'update', value: string): void
2626
}>()
2727
28+
/* ✗ BAD */
29+
const emit = defineEmits({
30+
change: (id) => typeof id == 'number',
31+
update: (value) => typeof value == 'string'
32+
})
33+
2834
/* ✗ BAD */
2935
const emit = defineEmits(['change', 'update'])
3036
</script>
@@ -53,6 +59,12 @@ const emit = defineEmits<{
5359
(e: 'update', value: string): void
5460
}>()
5561
62+
/* ✓ GOOD */
63+
const emit = defineEmits({
64+
change: (id) => typeof id == 'number',
65+
update: (value) => typeof value == 'string'
66+
})
67+
5668
/* ✓ GOOD */
5769
const emit = defineEmits(['change', 'update'])
5870
</script>

0 commit comments

Comments
 (0)