Skip to content
public-library›Rules›TypeScript›Declare constants with as const, and satisfies when a type exists

Declare constants with as const, and satisfies when a type exists

Declare constant objects and arrays with as const, so their values keep literal types and become readonly. When the constant must match an existing type, add satisfies to check it without widening.

In the full rule