Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 467e85f

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

File tree

1 file changed

+12
-0
lines changed
Filter options

1 file changed

+12
-0
lines changed

‎docs/rules/define-emits-declaration.md

Copy file name to clipboardExpand all lines: docs/rules/define-emits-declaration.md
+12Lines changed: 12 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.