How to type routeParams in Angular2?

Viewed 773

I have defined routeParam in a RouteConfig:

{ path: '/user/:id', name: 'User', component: User }

In my code I am calling the router's navigation method:

userSelected(userid) {
    this._router.navigate(['User', { id: userid }]);
}

The compiler tells me the following:

Argument of type '(string | { id: any; })[]' is not assignable to parameter of type 'string.

How can I type the parameter id, so the compiler detects it as a number?

1 Answers
Related