对于以下课程:
module LayoutEngine {
enum DocumentFormat {
DOCX = 1
};
export class DocHeader {
public format : DocumentFormat;
}
}
Run Code Online (Sandbox Code Playgroud)
我有两个问题:
谢谢 - 戴夫
bas*_*rat 34
上面有一个编译错误,它说"导出类的公共属性'格式'已经或正在使用私有类型'DocumentFormat'.
只需出口:
module LayoutEngine {
export enum DocumentFormat {
DOCX = 1
};
export class DocHeader {
public format : DocumentFormat;
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法将枚举声明放在类中?
所述enum打字稿类型需要处于一个模块级(文件或模块内).当然,如果你想在类中使用json对象
module LayoutEngine {
export class DocHeader {
DocumentFormat = {
DOCX: 1
};
public format : number;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28695 次 |
| 最近记录: |