qiu*_*tao 5 typescript eslint tslint
我已经用 in ts 编写了 js 代码。但现在我有一些 lint 错误链接。
4:1 error ES2015 module syntax is preferred over custom TypeScript modules and namespaces typescript/no-namespace
4:1 error Use 'namespace' instead of 'module' to declare custom TypeScript modules typescript/prefer-namespace-keyword
Run Code Online (Sandbox Code Playgroud)
我已经这样声明了
declare global {
interface Window {
aa: any;
}
}
Run Code Online (Sandbox Code Playgroud)
和使用like一样,就可以了,但是只是调用lint错误
if (typeof window.aa !== 'undefined') {
// dosth
}
Run Code Online (Sandbox Code Playgroud)
我无法理解错误消息,并且我已阅读文档,但仍然对其感到困惑
| 归档时间: |
|
| 查看次数: |
1000 次 |
| 最近记录: |