Vue-router: Missing TS definition for router push

Created on 7 Apr 2017  路  3Comments  路  Source: vuejs/vue-router

Version

2.3.0

Reproduction link

https://jsfiddle.net/7syt1bdu/

Steps to reproduce

When writing router.push({name: 'xx', params: {id: 2}} TS will complain about the type is not right.

What is expected?

Problem free TS compilation :-)

What is actually happening?

TS error


adding this to types/router.d.ts, fix the issue :

export interface LocationObject {
    name?: string,
    path?: string,
    params?: Object
    query?: Object
}
export type RawLocation = string | Location | LocationObject;
improvement

Most helpful comment

Location params and query may only hold string values, and I passed along a number. Sorry, move on ... nothing to see :-)

All 3 comments

A PR would be even better 馃檪

Ok, i make the PR danse 馃榿

Location params and query may only hold string values, and I passed along a number. Sorry, move on ... nothing to see :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexstanbury picture alexstanbury  路  3Comments

sqal picture sqal  路  3Comments

shinygang picture shinygang  路  3Comments

posva picture posva  路  3Comments

saman picture saman  路  3Comments