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

Commit df1ae40

Browse files
author
Andy Hanson
committed
Add documentation for shorthand ambient modules
1 parent 64c3564 commit df1ae40

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pages/Modules.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,23 @@ import * as URL from "url";
500500
let myUrl = URL.parse("http://www.typescriptlang.org");
501501
```
502502

503+
### Shorthand ambient modules
504+
505+
If you don't want to take the time to write out declarations before using a new module, you can use a shorthand declaration to get started quickly.
506+
507+
##### declarations.d.ts
508+
509+
```ts
510+
declare module "hot-new-module";
511+
```
512+
513+
All imports from a shorthand module with have the `any` type.
514+
515+
```ts
516+
import x, {y} from "hot-new-module";
517+
x(y);
518+
```
519+
503520
# Guidance for structuring modules
504521

505522
## Export as close to top-level as possible

0 commit comments

Comments
 (0)