Skip to content
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

useRoute().params in typescript #1585

Closed
dongnaebi opened this issue Oct 20, 2022 · 3 comments
Closed

useRoute().params in typescript #1585

dongnaebi opened this issue Oct 20, 2022 · 3 comments

Comments

@dongnaebi
Copy link

Version

4.1.5

Reproduction link

github.com

Steps to reproduce

setup () {
    const route = useRoute()
    const id: string = route.params.id
}

What is expected?

got a type error

TS2322: Type 'string | string[]' is not assignable to type 'string'.   Type 'string[]' is not assignable to type 'string'.

What is actually happening?

type error


export a useParams method or add generic for useRoute

@dongnaebi
Copy link
Author

sorry I just find a same issue: #1160

so, any plan for this?

@posva
Copy link
Member

posva commented Oct 20, 2022

Duplicate of #1160

@posva posva marked this as a duplicate of #1160 Oct 20, 2022
@posva posva closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2022
@posva
Copy link
Member

posva commented Oct 20, 2022

Please, search existing issues and pull requests before opening issues, it saves maintainers a lot of time 🙏

@vuejs vuejs locked and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants