prefer-as-const
Configuration
rslint.config.ts
Rule Details
Enforce the use of as const over literal type assertions. Using as const is preferred because it more clearly expresses intent, consistently applies to all literal values, and enables deeper immutability for objects and arrays.
This rule flags type assertions (as or angle-bracket style) and type annotations on variable or property declarations where the asserted/annotated type is a literal type that matches the literal value.
Examples of incorrect code for this rule:
Examples of correct code for this rule: