我有一个关于以下使用typescript数组的问题.这一切都很好但是当我通过linter运行时我得到以下错误,我的任务显然是错误的.
对于简单类型,禁止使用"Array"的数组类型.请改用'T []'.
export let data = [
{
"property": "value"
}
];
export interface myInterface {
property: string;
};
protected _collection: Array<myInterface>;
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
Nit*_*mer 11
linter可能只是想让你做:
protected _collection: myInterface[];
Run Code Online (Sandbox Code Playgroud)
类型myInterface[]和Array<myInterface>等价,但linter似乎更喜欢第一个.
| 归档时间: |
|
| 查看次数: |
5710 次 |
| 最近记录: |