Skip to content

MenuItem: type of to should be RouteLocationRaw  #1933

Closed
@LorianColtof

Description

@LorianColtof

I'm submitting a ... (check one with "x")

[x] bug report 
[ ] feature request
[ ] support request

CodeSandbox Case (Bug Reports)
(TypeScript)
The to field on <router-link> allows for more than just string paths, e.g. named routes.
The type of the to field on MenuItem currently does not allow this because it is string:

const test: MenuItem = {
  label: 'Test',
  to: { name: 'my-named-route' },
};

Current behavior
The type is string, and does thus not allow having named routes as in the example above.

Expected behavior
The type should be RouteLocationRaw, which aligns with the type of the to field on <router-link>: https://github.com/vuejs/vue-router-next/blob/master/src/RouterLink.ts#L45

Minimal reproduction of the problem with instructions
See above

What is the motivation / use case for changing the behavior?
Improved TypeScript support for the MenuModel.

Please tell us about your environment:
Vue CLI with TypeScript

  • Vue version: 3.X

  • PrimeVue version: 3.10.0

  • Browser: all

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type: BugIssue contains a bug related to a specific component. Something about the component is not working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions