That test acts as a type guard to ensure that, within the test's code block, you have the right object. In addition, with TypeScript 2.0, switch statements can act as type guards. As an example, in ...
Microsoft's open-source programming language TypeScript – the alter ego of JavaScript but with a type system – turns 10 years old this December. It's grown to become a go-to language for building apps ...