考虑以下简单的接口和类:
interface ITest{
id :string;
}
class SuperClass<T extends ITest>{
Start(){
var item=<ITest>{};
this.Do(item);
}
Do(item: T){
alert(item);
}
}
Run Code Online (Sandbox Code Playgroud)
该行this.Do(item)显示错误:Argument of type ITest is not assignable to type T.为什么?
typescript ×1