Binder

The TypeScript textbook by Basarat Ali Syed describes the binder as follows:

"The binder is used to connect the various parts of the source code into a coherent type system that can then be used by the checker. The main responsibility of the binder is to create the Symbols."

TypeScript supports a feature known as declaration merging, which allows us to merge two separate declarations declared with the same name into a single definition. For example, the following code snippet declares two interfaces named Person and a variable named person:

interface Person { 
    name: string; 
} 
 
interface Person { 
    surname: string; 
} 
 
const person: Person = { name: "Remo", surname: "Jansen" }; 

The type of the variable is Person, and as we can see, the type ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.