'{ relativeTo: Router; 类型的参数}' 不可分配给 'NavigationExtras' 类型的参数

Argument of type '{ relativeTo: Router; }' is not assignable to parameter of type 'NavigationExtras'

添加相对路径时编译错误。

import { Component, OnInit } from '@angular/core';

import { ServersService } from '../servers.service';
import { ActivatedRoute, Params, Router } from '@angular/router';

constructor(private serversService: ServersService, private route: Router, private acRoute: ActivatedRoute) { }

onEditServer()
  {
        this.route.navigate(['edit'], {relativeTo: this.route});
  }

这部分有错误 {relativeTo: this.route}

错误说明:

error TS2345: Argument of type '{ relativeTo: Router; }' is not assignable to parameter of type 'NavigationExtras'.
Types of property 'relativeTo' are incompatible.
Type 'Router' is not assignable to type 'ActivatedRoute'.
Property 'params' is missing in type 'Router'.

我哪里错了?

您需要在第二个参数

中使用acRoute而不是route
  onEditServer() {
    this.route.navigate(['edit'], { relativeTo: this.acRoute});
  }