Skip to content

vue-router@5 can't extend RouterLinkProps and other types #2611

@lubomirblazekcz

Description

@lubomirblazekcz

Reproduction

https://stackblitz.com/edit/vitejs-vite-fmmdned7?file=src%2Fcomponents%2FHelloWorld.vue

Steps to reproduce the bug

Try to extend vue-router RouterLinkProps

Expected behavior

Should work as in 4.6.4 https://stackblitz.com/edit/vitejs-vite-o1wkphar?file=src%2Fcomponents%2FHelloWorld.vue

Actual behavior

[@vue/compiler-sfc] Failed to resolve extends base type.
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:

interface Props extends /* @vue-ignore */ Base {}

Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.

/Users/lubomirblazek/Documents/GitHub/bookoloengine-fe/src/components/(ui)/button/Button.vue
6 | type sizes = 'xs' | 'sm' | 'md' | 'lg'
7 |
8 | interface Props extends Omit<RouterLinkProps, 'to'> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
9 | to?: RouteLocationRaw
10 | as?: string

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalblocked by an external dependencyhas workaroundhas a temporary fix to get around the problem👍 contribution welcomeothers are welcome to implement/fix this🔹 typescriptissue related to types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions