Type Assertions

Type assertions are used to tell the TypeScript compiler about the type of a variable.

Snippet:

let someValue: any = "Hello"; let strLength: number = (someValue as string).length;

Example:

let input = document.querySelector("input") as HTMLInputElement;