We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 838b2f6 commit d21f77eCopy full SHA for d21f77e
docs/declare.md
@@ -206,15 +206,15 @@ declare 关键字的另一个用途,是为外部模块添加属性和方法时
206
import { Foo as Bar } from 'moduleA';
207
208
declare module 'moduleA' {
209
- interface Bar {
+ interface Foo {
210
custom: {
211
prop1: string;
212
}
213
214
215
```
216
217
-上面示例中,从模块`moduleA`导入了`Foo`接口,将其重命名为`Bar`,并用 declare 关键字为`Bar`增加一个属性`custom`。
+上面示例中,从模块`moduleA`导入了类型`Foo`,它是一个接口(interface),并将其重命名为`Bar`,然后用 declare 关键字为`Foo`增加一个属性`custom`。这里需要注意的是,虽然接口`Foo`改名为`Bar`,但是扩充类型时,还是扩充原始的接口`Foo`,因为同名 interface 会自动合并类型声明。
218
219
下面是另一个例子。一个项目有多个模块,可以在一个模块中,对另一个模块的接口进行类型扩展。
220
0 commit comments