Functions
A function is a sequence of instructions that can transform some specified input into a specified output.
Describing functions
A common way to describe a function is with a function type expression.
Another way to describe a function is with an arrow function.
Defining functions with the arrow syntax is especially useful when working with functions as values. Suppose in the example above, we want to make it as easy as possible for a future developer to add support for new languages.
Return types
The type returned by a function
Parameter types
Each parameter can be typed
Construct signatures
JavaScript functions can be invoked with the new
operator, which creates a special object
that is referred to as an instance. TypeScript refers to these as constructors, because they usually "construct"
a new object.
You can write a construct signature by adding the new
keyword in front of a call signature.