23.06.2015 Views

TypeScript Language Specification v1.5

TypeScript Language Specification v1.5

TypeScript Language Specification v1.5

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A super call invokes the constructor of the base class on the instance referenced by this. A super call is<br />

processed as a function call (section 4.12) using the construct signatures of the base class constructor<br />

function type as the initial set of candidate signatures for overload resolution. Type arguments cannot be<br />

explicitly specified in a super call. If the base class is a generic class, the type arguments used to process a<br />

super call are always those specified in the extends clause that references the base class.<br />

The type of a super call expression is Void.<br />

The JavaScript code generated for a super call is specified in section 8.6.2.<br />

4.8.2 Super Property Access<br />

A super property access consists of the keyword super followed by a dot and an identifier. Super property<br />

accesses are used to access base class member functions from derived classes and are permitted in<br />

contexts where this (section 4.2) references a derived class instance or a derived class constructor<br />

function. Specifically:<br />

<br />

<br />

In a constructor, instance member function, instance member accessor, or instance member<br />

variable initializer where this references a derived class instance, a super property access is<br />

permitted and must specify a public instance member function of the base class.<br />

In a static member function or static member accessor where this references the constructor<br />

function object of a derived class, a super property access is permitted and must specify a public<br />

static member function of the base class.<br />

Super property accesses are not permitted in other contexts, and it is not possible to access other kinds of<br />

base class members in a super property access. Note that super property accesses are not permitted<br />

inside standard function expressions nested in the above constructs because this is of type Any in such<br />

function expressions.<br />

Super property accesses are typically used to access overridden base class member functions from<br />

derived class member functions. For an example of this, see section 8.4.2.<br />

The JavaScript code generated for a super property access is specified in section 8.6.2.<br />

4.9 Function Expressions<br />

Function expressions are extended from JavaScript to optionally include parameter and return type<br />

annotations, and a new compact form, called arrow function expressions, is introduced.<br />

FunctionExpression: ( Modified )<br />

function Identifier opt CallSignature { FunctionBody }<br />

AssignmentExpression: ( Modified )<br />

…<br />

ArrowFunctionExpression<br />

62

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

Saved successfully!

Ooh no, something went wrong!