April 2018
Beginner
536 pages
13h 21m
English
The TypeScript type system allows us to declare types (such as type aliases, classes, and interfaces) within the declaration of functions and methods. In the early releases of TypeScript, this was not allowed:
interface Person { name: string; age: number;}function makePerson(name: string, age: number): Person { // Local type class Person implements Person { constructor( public name: string, public age: number ) {} } return new Person(name, age);}let user = makePerson("Remo", 28);