as (type assertion)
Informs TS of a value's type.
Syntax
value as Type
Description
If you know the type of a value, you specify it with 'as'. Use with caution — if wrong, it can cause runtime errors.
Example
Loading editor…
Expected output
HELLO
When to use?
Narrowing external/unknown data to a known type.