Skip to content

Feature Request: Automattic EventTarget detection #222

@cawa-93

Description

@cawa-93

I have simple code in template:

      <a
        href="https://github.com/cawa-93/anime-library/issues/new/choose"
        @click.prevent="openURL($event.target.href)"
      >🐞 Bug</a>

And I got TS error:

error TS2531: Object is possibly 'null'.
     @click.prevent="openURL($event.target.href)"
                             ~~~~~~~~~~~~~

error TS2339: Property 'href' does not exist on type 'EventTarget'.
     @click.prevent="openURL($event.target.href)"
                                           ~~~~

It would be fantastic if the TS determined that

  1. EventTarget actually is HTMLAnchorElement
  2. It is guaranteed exist

I use vue-tsc with PhpSthorm if this have matter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions