Skip to content

Glossary: TypeScript Beyond the Basics

as (type assertion)

Also written: as Order, as readonly string[]

A keyword that tells TypeScript to treat a value as a type you name, without checking it. `res.json() as Order` is only a claim, so wrong data still gets through.

Where the book teaches it

Related terms

Type predicate