router icon indicating copy to clipboard operation
router copied to clipboard

fix(types): normalized Query can have undefined properties

Open andresespinosapc opened this issue 3 years ago • 1 comments

When a query param is not present the query value is undefined, but the type is only string | null.

Here is the extract of code where I had this problem:

const route = useRoute();
const sortBy = ref(route.query.sort_by.toString())

I got Cannot read property 'toString' of undefined but the linter didn't give any errors.

andresespinosapc avatar Aug 10 '22 15:08 andresespinosapc

Deploy Preview for vue-router canceled.

Name Link
Latest commit 41cb32949f4eeb0b6c360049ec3d58aba5e81c89
Latest deploy log https://app.netlify.com/sites/vue-router/deploys/62f3d2f9467bdd0008557e03

netlify[bot] avatar Aug 10 '22 15:08 netlify[bot]