0
我试图写了一个接口类,其中还包含其他类,但是当我这样做,但不知道什么是错的我收到一个错误接口类:与嵌套类的打字稿
接口:
export interface Languages{
static English = class{
id: number,
section:number,
name: string
},
static Chinese = class{
id: number,
section: number,
name: string
}
}
两个static
和English
都出现错误,指出:[ts] Property or signature expected. [ts] Cannot find name 'English'.
接口中没有'static'。一个接口描述实例的外观。如果你想描述静态成员/方法,你需要创建一个不同的接口来表示它,就像你使用[Array](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.d。例如ts#L1111)和[ArrayConstructor](https://github.com/Microsoft/TypeScript/blob/master/lib/lib.d.ts#L1294) –