TypeScript Language Specification v1.5
TypeScript Language Specification v1.5
TypeScript Language Specification v1.5
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
When an identifier is resolved as a TypeName (section 3.7.2), only classes, interfaces, enums, and type<br />
parameters are considered and other entities in scope are ignored.<br />
When an identifier is resolved as a ModuleName (section 3.7.2), only modules are considered and other<br />
entities in scope are ignored.<br />
When an identifier is resolved as a PrimaryExpression (section 4.3), only instantiated modules (section<br />
10.1), classes, enums, functions, variables, and parameters are considered and other entities in scope are<br />
ignored.<br />
Note that class and enum members are never directly in scope—they can only be accessed by applying<br />
the dot ('.') operator to a class instance or enum object. This even includes members of the current<br />
instance in a constructor or member function, which are accessed by applying the dot operator to this.<br />
As the rules above imply, locally declared entities in an internal module are closer in scope than exported<br />
entities declared in other module declarations for the same internal module. For example:<br />
var x = 1;<br />
module M {<br />
export var x = 2;<br />
console.log(x); // 2<br />
}<br />
module M {<br />
console.log(x); // 2<br />
}<br />
module M {<br />
var x = 3;<br />
console.log(x); // 3<br />
}<br />
21