Skip to content

Using event handler with RouterLink combined with vueCompilerOptions strictTemplates gives TS errorΒ #2484

Open
@line301u

Description

@line301u

Reproduction

https://github.com/line301u/reproduction-vuerouter-issue-routerlink-stricttemplates

Steps to reproduce the bug

The steps are already added to the reproduction:
run pnpm run type-check to get the TS error

If setting up a new vue project, use these steps to reproduce:
In your the tsconfig.json, add:

  "vueCompilerOptions": {
    "strictTemplates": true
  },

Use RouterLink component with any event handler - e.g.:
<RouterLink to="/" @focus="console.log('focus')" />

Run typecheck with the following command: pnpm run type-check

Expected behavior

I wouldn't expect to get an error for using event handlers on the RouterLink component

Actual behavior

If you use the vueCompilerOptions strictTemplates feature, and add any event handler to the RouterLink component, it will give a TypeScript error because of the handler. The actual functionality of the handler works.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeThe team would welcome a contribution from the community for this issuetypescriptProblem related to TS typings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions