23.06.2015 Views

TypeScript Language Specification v1.5

TypeScript Language Specification v1.5

TypeScript Language Specification v1.5

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external<br />

modules only through top-level external module names. Relative external module names are not<br />

permitted.<br />

If an ambient external module declaration includes an export assignment, it is an error for any of the<br />

declarations within the module to specify an export modifier. If an ambient external module declaration<br />

contains no export assignment, entities declared in the module are exported regardless of whether their<br />

declarations include the optional export modifier.<br />

Ambient external modules are "open-ended" and ambient external module declarations with the same<br />

string literal name contribute to a single external module. For example, the following two declarations of<br />

an external module 'io' might be located in separate source files.<br />

declare module "io" {<br />

export function readFile(filename: string): string;<br />

}<br />

declare module "io" {<br />

export function writeFile(filename: string, data: string): void;<br />

}<br />

This has the same effect as a single combined declaration:<br />

declare module "io" {<br />

export function readFile(filename: string): string;<br />

export function writeFile(filename: string, data: string): void;<br />

}<br />

154

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!