TypeScript · Types and shapes

Function type

Describes a function signature, including parameters and return type.

Syntax
(a: number) => string

Example

Example
type Formatter = (value: number) => string;
const format: Formatter = value => value.toFixed(1);

More in this group

any Array types enums Interface Literal type never null and undefined Optional property

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course