Type Assertions#
Type assertions tell TypeScript to treat a value as a specific type. They don't perform runtime conversion — they only affect the type checker. Use them sparingly and prefer type guards when possible.
Type Assertions
Telling TypeScript what type a value is
Type assertions override TypeScript's inferred type