我有两个接口。接口B
是通用接口,而接口export interface A {
foo: {
bar1: any;
bar2: any;
}
}
export interface B extends A {
foo: {
bar3: any;
}
specialBar: Function
}
是一种较少使用的特殊扩展。
B.foo
如何设置A.foo ('bar1', 'bar2')
继承B.foo
上的属性,同时扩展('bar3')
以包含新属性A.foo
?
有没有办法扩展A.foo
而不给Incompatible override for member from interface A
自己的接口?
目前,WebStorm正在抛出错误:[TestMethod]
[DeploymentItem(@"MyProject.Tests\TestFiles\file.txt")]
public void MyTest()
{
var myfile= "file.txt";
Assert.IsTrue(
File.Exists(myfile),
"Deployment failed: {0} did not get deployed.",
myfile
);
}
。
答案 0 :(得分:0)
可能不是你真正想要的,但有这个黑客:
const _a = undefined as A
export interface B extends A {
foo: typeof _a.foo & {
bar3: any;
}
specialBar: Function
}