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.

Index member declarations have no body and cannot specify an accessibility modifier.<br />

A class declaration can have at most one string index member declaration and one numeric index<br />

member declaration. All instance property members of a class must satisfy the constraints implied by the<br />

index members of the class as specified in section 3.8.4.<br />

It is not possible to declare index members for the static side of a class.<br />

Note that it is seldom meaningful to include a string index signature in a class because it constrains all<br />

instance properties of the class. However, numeric index signatures can be useful to control the element<br />

type when a class is used in an array-like manner.<br />

8.6 Code Generation<br />

This section describes the structure of the JavaScript code generated from <strong>TypeScript</strong> classes.<br />

8.6.1 Classes Without Extends Clauses<br />

A class with no extends clause generates JavaScript equivalent to the following:<br />

var = (function () {<br />

function () {<br />

<br />

<br />

<br />

<br />

}<br />

<br />

<br />

return ;<br />

})();<br />

ClassName is the name of the class.<br />

ConstructorParameters is a comma separated list of the constructor's parameter names.<br />

DefaultValueAssignments is a sequence of default property value assignments corresponding to those<br />

generated for a regular function declaration, as described in section 6.6.<br />

ParameterPropertyAssignments is a sequence of assignments, one for each parameter property declaration<br />

in the constructor, in order they are declared, of the form<br />

this. = ;<br />

where ParameterName is the name of a parameter property.<br />

124

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

Saved successfully!

Ooh no, something went wrong!