1

From the Vue documentation:

// named route
// !!! the parameter can be a number
router.push({ name: 'user', params: { userId: 123 }})

Whereas in Typescript:

push (location: RawLocation, onComplete?: Function, onAbort?: Function): void;

export interface Location {
  name?: string;
  path?: string;
  hash?: string;
  query?: Dictionary<string>;
  // !!! must be a string:
  params?: Dictionary<string>;
  append?: boolean;
  replace?: boolean;
}
Xavier Peña
  • 7,399
  • 9
  • 57
  • 99
  • Plus I see that [there is no way to overwrite the underlying interface](https://stackoverflow.com/questions/41285211/typescript-overriding-interface-property-type-defined-in-d-ts) .... – Xavier Peña Feb 10 '18 at 17:04
  • 1
    Since params are based on the url, they are required to be strings, because the url the user uses to access your application can accept free text – Ferrybig Feb 10 '18 at 19:47
  • @Ferrybig I see, thanks. That makes sense. So I guess I'll have to put `paramNameStr` as a @Prop, and then parse it to `paramName` during `mounted()`. I don't know if there is a better practice for that. – Xavier Peña Feb 11 '18 at 11:43

0 Answers0