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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →