Skip to content

TS throwing "missing param for named route..." when param is empty string and runtime error when is empty string #3838

@VividLemon

Description

@VividLemon

This is the original issue, I linked it in the wrong location vuejs/router#1801 (comment)

I created a reproduction https://github.com/VividLemon/vue-router-issue

Here is the issue in summary:

When you do this.$router.push( { name: 'about', params: { id: undefined } } ). This works, but throws a TS error

When you do this.$router.push( { name: 'about', params: { id: '' } } ), this does NOT work, but throws no error.

It will "appear" as if it works (for the second) but will not actually change the URL, and will throw a console warn.

This issue does not occur for vue-router@4 & vue 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions