Angular 我想强制转换组件以使用它

Angular 我想强制转换组件以使用它,angular,Angular,我使用子路由。我在活动路由中得到了父组件。但是我不知道如何转换它以便使用它和调用方法 constructor( public router : Router, public route : ActivatedRoute) { } ngOnInit() { let comp = (this.route.parent.component as Type<RegisterComponent>); console.log(comp); } 构造函数(公共路由器:路由

我使用子路由。我在活动路由中得到了父组件。但是我不知道如何转换它以便使用它和调用方法

constructor( public router : Router, public route : ActivatedRoute) { }

ngOnInit() { 
    let comp =  (this.route.parent.component as Type<RegisterComponent>); 
    console.log(comp);
}
构造函数(公共路由器:路由器,公共路由:ActivatedRoute){
ngOnInit(){
让comp=(this.route.parent.component作为类型);
控制台日志(comp);
}
两种不同的方式:

let comp = <RegisterComponent> this.route.parent.component;

谢谢你的回答。执行此操作时,编辑器显示一个错误:type string | type无法转换为type RegisterComponent。类型“Type”与类型寄存器组件不可比较。为什么?
let comp = this.route.parent.component as RegisterComponent;