TSworkingts-evergreen
const assertions (as const)
Freeze the value, keep the literals.
as const tells TypeScript to infer the narrowest possible type — literal strings instead of string, readonly tuples instead of arrays — which is the key to deriving union types from plain data.
Widening vs as const
TSintro Press Run to execute
All three print GET at runtime, but the types differ: loose.method is the wide string, while tight.method and m are the literal 'GET' — so as const changes what the compiler will accept without changing the value.