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.

interface A {<br />

x: number;<br />

f: () => void;<br />

g: (a: any) => any;<br />

}<br />

and the instance type of 'B' is<br />

interface B {<br />

x: number;<br />

y: number;<br />

f: () => void;<br />

g: (b: boolean) => boolean;<br />

}<br />

Note that static declarations in a class do not contribute to the class type and its instance type—rather,<br />

static declarations introduce properties on the constructor function object. Also note that the declaration<br />

of 'g' in 'B' overrides the member inherited from 'A'.<br />

8.2.5 Constructor Function Types<br />

The type of the constructor function introduced by a class declaration is called the constructor function<br />

type. The constructor function type has the following members:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

If the class contains no constructor declaration and has no base class, a single construct signature<br />

with no parameters, having the same type parameters as the class and returning the instance type<br />

of the class.<br />

If the class contains no constructor declaration and has a base class, a set of construct signatures<br />

with the same parameters as those of the base class constructor function type following<br />

substitution of type parameters with the type arguments specified in the base class type<br />

reference, all having the same type parameters as the class and returning the instance type of the<br />

class.<br />

If the class contains a constructor declaration with no overloads, a construct signature with the<br />

parameter list of the constructor implementation, having the same type parameters as the class<br />

and returning the instance type of the class.<br />

If the class contains a constructor declaration with overloads, a set of construct signatures with<br />

the parameter lists of the overloads, all having the same type parameters as the class and<br />

returning the instance type of the class.<br />

A property for each static member variable declaration in the class body.<br />

A property of a function type for each static member function declaration in the class body.<br />

A property for each uniquely named static member accessor declaration in the class body.<br />

A property named 'prototype', the type of which is an instantiation of the class type with type Any<br />

supplied as a type argument for each type parameter.<br />

All base class constructor function type properties that are not overridden in the class.<br />

115

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

Saved successfully!

Ooh no, something went wrong!