Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit edc8a21

Browse files
author
Andy
authored
Merge pull request #322 from Microsoft/umd
Document UMD module definitions
2 parents 9f3467b + b1e5f80 commit edc8a21

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pages/Writing Declaration Files.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ declare var widget: WidgetFactory;
174174

175175
## Global / External-agnostic Libraries
176176

177+
These libraries can be used as either globals or imports.
178+
In a module file (one with any imports/exports), using these as globals is not allowed.
179+
These are also known as [UMD](https://github.com/umdjs/umd) modules.
180+
177181
#### Usage
178182

179183
```ts
@@ -187,13 +191,8 @@ zoo.open();
187191
#### Typing
188192

189193
```ts
190-
declare namespace zoo {
191-
function open(): void;
192-
}
193-
194-
declare module "zoo" {
195-
export = zoo;
196-
}
194+
export function open(): void;
195+
export as namespace zoo;
197196
```
198197

199198
## Single Complex Object in Modules

0 commit comments

Comments
 (0)