From df1ae408a44f4e698d7f2f5a053ea79d03a1b60d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 24 Jun 2016 07:29:02 -0700 Subject: [PATCH 1/2] Add documentation for shorthand ambient modules --- pages/Modules.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pages/Modules.md b/pages/Modules.md index 9689f8b4c..e72bcb733 100644 --- a/pages/Modules.md +++ b/pages/Modules.md @@ -500,6 +500,23 @@ import * as URL from "url"; let myUrl = URL.parse("http://www.typescriptlang.org"); ``` +### Shorthand ambient modules + +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. + +##### declarations.d.ts + +```ts +declare module "hot-new-module"; +``` + +All imports from a shorthand module with have the `any` type. + +```ts +import x, {y} from "hot-new-module"; +x(y); +``` + # Guidance for structuring modules ## Export as close to top-level as possible From 7b2c80ab7c2537f2e3e4188f32805bd3ea45cb26 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 24 Jun 2016 09:45:07 -0700 Subject: [PATCH 2/2] Fix typo --- pages/Modules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/Modules.md b/pages/Modules.md index e72bcb733..91524cd7b 100644 --- a/pages/Modules.md +++ b/pages/Modules.md @@ -510,7 +510,7 @@ If you don't want to take the time to write out declarations before using a new declare module "hot-new-module"; ``` -All imports from a shorthand module with have the `any` type. +All imports from a shorthand module will have the `any` type. ```ts import x, {y} from "hot-new-module";