第19章 关于补充声明Window全局对象属性的问题
Closed this issue · 1 comments
ArisLittle commented
阮老师您好。我是您的一名小读者。原文,在 ./docs/declare.md
typescript-tutorial/docs/declare.md
Line 305 in d8b2606
下面的示例是为 window 对象添加一个属性`myAppConfig`。
```typescript
export {};
declare global {
interface window {
myAppConfig: object;
}
}
const config = window.myAppConfig;
```
declare global 里 interface 后面的 window 的首字母 w 似乎需要大写,才能让 TS 识别接口类型。我这边 TS 版本是5.3.2。不知道这算不算一个问题呢?
ruanyf commented
谢谢指出,已经更正。