Skip to content

bug: (vue) router-link has wrong type since 8.4.5/8.5.0 #30254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
mattschlosser opened this issue Mar 13, 2025 · 7 comments · Fixed by #30259
Closed
3 tasks done

bug: (vue) router-link has wrong type since 8.4.5/8.5.0 #30254

mattschlosser opened this issue Mar 13, 2025 · 7 comments · Fixed by #30259
Assignees
Labels
package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@mattschlosser
Copy link

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

router-link has the wrong type since 8.4.5. When attempting to build, the build fails with error TS2322

src/views/HomePage.vue:4:25 - error TS2322: Type 'string' is not assignable to type 'Symbol'.

4             <ion-button router-link="/about">
                          ~~~~~~~~~~~

Expected Behavior

vue-tsc produces no errors

Steps to Reproduce

  1. Create new project and ensure using @ionic/vue 8.4.5+
  2. import any ionic component and attempt to use the router-link prop as described in the docs
  3. attempt to build the project using npm run build
  4. invalid type error is produced
    Image

Code Reproduction URL

https://github.com/mattschlosser/ionic-vue-ts-demo/tree/router-link

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\Users\...\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/vue 8.5.0

Capacitor:

Capacitor CLI : 7.0.1
@capacitor/android : not installed
@capacitor/core : 7.0.1
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v22.14.0 (C:\Program Files\nodejs\node.exe)
npm : 10.9.2
OS : Windows 10

Additional Information

#30221

@ionitron-bot ionitron-bot bot added the triage label Mar 13, 2025
@trydofor
Copy link

It's also in 8.4.4

@brandyscarney
Copy link
Member

Thank you for the issue. 🙂 Could you try out this dev build and let me know if you're seeing any other issues:

npm i @ionic/vue@8.5.1-dev.11742222905.16af9151 @ionic/vue-router@8.5.1-dev.11742222905.16af9151

@mattschlosser
Copy link
Author

While I see the string type has been added, there are other values that can be passed that work for router-link but TS reports the wrong type. I have updated the example repo above with more examples, which all work running npm run dev, but vue-tsc fails.

Types accepted by router.push are listed here: https://router.vuejs.org/api/interfaces/Router.html#push-

Image

Thanks again

@brandyscarney
Copy link
Member

Thank you @mattschlosser! Here is a new dev build: 8.5.1-dev.11742238707.15ce0fe2

@mattschlosser
Copy link
Author

That build fixes the issue. Thanks

github-merge-queue bot pushed a commit that referenced this issue Mar 18, 2025
Issue number: resolves #30254

---------

## What is the current behavior?
The type for `routerLink` was incorrectly set as `symbol`.

## What is the new behavior?
The new update of the Vue output target to sets it to `string | symbol`

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

Dev build: `8.5.1-dev.11742238707.15ce0fe2`

---------

Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
brandyscarney added a commit that referenced this issue Mar 19, 2025
Issue number: resolves #30254

---------

The type for `routerLink` was incorrectly set as `symbol`.

The new update of the Vue output target to sets it to `string | symbol`

- [ ] Yes
- [x] No

Dev build: `8.5.1-dev.11742238707.15ce0fe2`

---------

Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
@brandyscarney
Copy link
Member

This fix has been released in 8.4.6 and 8.5.1. Thank you again for the issue! Please open a new issue if you find any other problems. 🙂

Copy link

ionitron-bot bot commented Apr 18, 2025

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Apr 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants