Skip to content

Force TypeScript only defineEmits #1960

@mesqueeb

Description

@mesqueeb

Please describe what the rule should do:
Forces the TypeScript only way of defining emits.

What category should the rule belong to?

[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

GOOD

const emit = defineEmits<{
  /**
   * The click event
   */
  (e: 'click', event: PointerEvent): void
}>()

BAD

const emit = defineEmits({
  /**
   * The click event
   */
  click: (event: PointerEvent) => !!event
})

BAD

const emit = defineEmits([
  /**
   * The click event
   */
  'click'
])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions