Typescript 从数组中声明类型
我如何在typescript中说出以下内容:Typescript 从数组中声明类型,typescript,Typescript,我如何在typescript中说出以下内容: interface X{ value:number } var bar:X[] = []; // Not an error // declare a type to be the same: interface Y extends Array<X>{ } var foo:Y = []; // Error 接口X{ 值:数字 } 变量栏:X[]=[];//不是错误 //声明类型相同: 接口Y扩展数组{ } 变量foo:Y=
interface X{
value:number
}
var bar:X[] = []; // Not an error
// declare a type to be the same:
interface Y extends Array<X>{
}
var foo:Y = []; // Error
接口X{
值:数字
}
变量栏:X[]=[];//不是错误
//声明类型相同:
接口Y扩展数组{
}
变量foo:Y=[];//错误
我确信这是编译器当前(0.9.0.1)版本中的一个错误:
是的,它似乎有点困惑<代码>无法将“Y[]”转换为“Y”根本不描述代码正在执行的操作。应将此标记为已回答,因为此问题已在链接的工作项中修复。已使用我的当前版本0.9.7进行验证