Skip to content

Commit

Permalink
docs(declare): fixed #91
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanyf committed Dec 11, 2023
1 parent d8b2606 commit f77f8d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/declare.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,13 @@ String.prototype.toSmallString = ():string => {

这个示例第一行的空导出语句`export {}`,作用是强制编译器将这个脚本当作模块处理。这是因为`declare global`必须用在模块里面。

下面的示例是为 window 对象添加一个属性`myAppConfig`
下面的示例是为 window 对象(类型接口为`Window`)添加一个属性`myAppConfig`

```typescript
export {};

declare global {
interface window {
interface Window {
myAppConfig:object;
}
}
Expand Down

0 comments on commit f77f8d1

Please sign in to comment.