Skip to content
Latchkey

TS7053: Element implicitly has an any type (index signature) - in CI

You indexed an object with a key type that has no matching index signature, so the result is implicitly any.

What this error means

Type-checking fails with TS7053 because a string/number key cannot index the object type.

tsc
src/lookup.ts(6,10): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ a: number; }'.

Common causes

How to fix it

Add an index signature or use keyof

  1. Declare an index signature if arbitrary keys are valid, or constrain the key to keyof T
ts
function get<T>(o: T, k: keyof T) { return o[k] }

Use a Record type

  1. Type the object as Record<string, V> when keys are open-ended
ts
const map: Record<string, number> = {}

How to prevent it

  • Type open-ended maps as Record<K, V> and constrain dynamic keys with keyof.

Frequently asked questions

What causes "TS7053 element implicitly any"?
Type-checking fails with TS7053 because a string/number key cannot index the object type.
How do I fix TS7053 element implicitly any?
Add an index signature or use keyof

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card