TypeScript
AmbientDeclaration:
declare AmbientVariableDeclaration
declare AmbientFunctionDeclaration
declare AmbientClassDeclaration
declare AmbientEnumDeclaration
declare AmbientModuleDeclaration
declare
AmbientVariableDeclaration:
var Identifier TypeAnnotationopt ;
AmbientFunctionDeclaration:
function ;
AmbientClassDeclaration:
class Identifier TypeParametersopt ClassHeritage { }
AmbientClassBody:
AmbientClassBodyElementsopt
AmbientClassBodyElements:
AmbientClassBodyElement
AmbientClassBodyElements AmbientClassBodyElement
AmbientClassBodyElement:
AmbientConstructorDeclaration
AmbientMemberDeclaration
IndexSignature
AmbientConstructorDeclaration:
constructor ( ParameterListopt ) ;
AmbientMemberDeclaration:
PublicOrPrivateopt staticopt PropertyName TypeAnnotationopt ;
PublicOrPrivateopt staticopt PropertyName CallSignature ;
An ambient enum declaration declares an enum type and an enum object in the containing module.
AmbientEnumDeclaration:
enum Identifier { AmbientEnumBodyopt
}
AmbientEnumBody:
AmbientEnumMemberList ,opt
AmbientEnumMemberList:
AmbientEnumMember
AmbientEnumMemberList , AmbientEnumMember
AmbientEnumMember:
PropertyName
PropertyName = IntegerLiteral
An AmbientEnumMember that includes an IntegerLiteral value is considered a constant member. An AmbientEnumMember with no IntegerLiteral value is considered a computed member.
An ambient module declaration declares an internal module.
AmbientModuleDeclaration:
module IdentifierPath {
AmbientModuleBody }
AmbientModuleBody:
AmbientModuleElementsopt
AmbientModuleElements:
AmbientModuleElement
AmbientModuleElements AmbientModuleElement
AmbientModuleElement:
exportopt AmbientVariableDeclaration
exportopt AmbientFunctionDeclaration
exportopt AmbientClassDeclaration
exportopt InterfaceDeclaration
exportopt AmbientEnumDeclaration
exportopt AmbientModuleDeclaration
exportopt ImportDeclaration
Except for ImportDeclarations, AmbientModuleElements always declare exported entities regardless of whether they include the optional export modifier.
An AmbientExternalModuleDeclaration declares an external module. This type of declaration is permitted only in the global module. The StringLiteral must specify a top-level external module name. Relative external module names are not permitted.
AmbientExternalModuleDeclaration:
module StringLiteral {
AmbientExternalModuleBody }
AmbientExternalModuleBody:
AmbientExternalModuleElementsopt
AmbientExternalModuleElements:
AmbientExternalModuleElement
AmbientExternalModuleElements AmbientExternalModuleElement
AmbientExternalModuleElement:
AmbientModuleElement
ExportAssignment
exportopt ExternalImportDeclaration
An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules only through top-level external module names. Relative external module names are not permitted.
If an ambient external module declaration includes an export assignment, it is an error for any of the declarations with the module to specify an export modifier. If an ambient external module declaration contains no export assignment, entities declared in the module are exported regardless of whether their declarations include the optional export modifier.
TypeScript Language Specification (converted to HTML pages by @Bartvds)
Version 0.9.1
August 2013
Microsoft is making this Specification available under the Open Web Foundation Final Specification Agreement Version 1.0 ('OWF 1.0') as of October 1, 2012. The OWF 1.0 is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
TypeScript is a trademark of Microsoft Corporation.