Skip to content

Glossary: React Native

as (type assertion)

Also written: as Error, color as string

A TypeScript phrase that tells the compiler what type a value really is, as in `(e as Error).message` for something caught in `catch`. It doesn't change the value at runtime.

Where the book teaches it