从数组声明一个类型

时间:2013-07-16 01:28:33

标签: 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 

1 个答案:

答案 0 :(得分:0)

我确信这是编译器当前(0.9.0.1)版本中的一个错误:https://typescript.codeplex.com/workitem/1355

Try it

相关问题