no-suppress-implicit-any-index-errors
Disallow "suppressImplicitAnyIndexErrors": true in compilerOptions.
Targeted pattern scopeโ
The compilerOptions.suppressImplicitAnyIndexErrors field in any
tsconfig*.json file.
What this rule reportsโ
This rule reports when compilerOptions.suppressImplicitAnyIndexErrors is
explicitly set to true.
Why this rule existsโ
TypeScript's noImplicitAny flag (included in strict: true) requires all
values to have an explicit type so that accidental any values cannot silently
propagate through the codebase. suppressImplicitAnyIndexErrors: true carves
out an exception to this: it suppresses the implicit-any error that would
normally appear when you index an object with a string key that has no matching
index signature.
Consider this pattern:
const config: Record<string, unknown> = {};
const value = config["timeout"]; // type is `unknown` โ safe
const options = { retries: 3 };
const value = options["timeout"]; // type is `any` when suppressImplicitAnyIndexErrors is true
With the option disabled (the default), the second example is a type error,
and the developer is forced to add an index signature or use a safer access
pattern. With suppressImplicitAnyIndexErrors: true, the error is silently
suppressed and value becomes any, bypassing strict-mode guarantees.
This option was historically used as a migration escape hatch. In modern
TypeScript projects, it should not be present in a finished configuration
because it creates a silent hole in noImplicitAny coverage.
โ Incorrectโ
{
"compilerOptions": {
"strict": true,
"suppressImplicitAnyIndexErrors": true
}
}
suppressImplicitAnyIndexErrors silences implicit-any errors for index
access, undermining noImplicitAny.
โ Correctโ
{
"compilerOptions": {
"strict": true
}
}
Without suppressImplicitAnyIndexErrors, TypeScript enforces noImplicitAny
consistently for all index-signature accesses.
Behavior and migration notesโ
When removing suppressImplicitAnyIndexErrors: true from an existing config,
TypeScript may report new type errors in files that relied on the suppression.
The typical fixes are:
- Add an explicit index signature to the type (e.g.,
Record<string, unknown>). - Use optional chaining or a type assertion with an explicit type.
- Prefer
noUncheckedIndexedAccess: truetogether with typed index signatures for the strongest guarantees.
When not to use itโ
Disable this rule only during a large-scale migration from a loosely typed
codebase where fixing all implicit-any index-access errors is not immediately
feasible.
Package documentationโ
Rule catalog ID: R036