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.

TypeMember:<br />

PropertySignature<br />

CallSignature<br />

ConstructSignature<br />

IndexSignature<br />

MethodSignature<br />

The members of an object type literal are specified as a combination of property, call, construct, index,<br />

and method signatures. Object type members are described in section 3.8.<br />

3.7.4 Array Type Literals<br />

An array type literal is written as an element type followed by an open and close square bracket.<br />

ArrayType:<br />

PrimaryType [no LineTerminator here] [ ]<br />

An array type literal references an array type (section 3.3.2) with the given element type. An array type<br />

literal is simply shorthand notation for a reference to the generic interface type 'Array' in the global<br />

module with the element type as a type argument.<br />

When union, function, or constructor types are used as array element types they must be enclosed in<br />

parentheses. For example:<br />

(string | number)[]<br />

(() => string))[]<br />

Alternatively, array types can be written using the 'Array' notation. For example, the types above are<br />

equivalent to<br />

Array<br />

Array string><br />

3.7.5 Tuple Type Literals<br />

A tuple type literal is written as a sequence of element types, separated by commas and enclosed in<br />

square brackets.<br />

TupleType:<br />

[ TupleElementTypes ]<br />

TupleElementTypes:<br />

TupleElementType<br />

TupleElementTypes , TupleElementType<br />

38

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

Saved successfully!

Ooh no, something went wrong!