Skip to content
Latchkey

TS7031: Binding element implicitly has an any type - in CI

A destructured parameter has no type, so each binding element is implicitly any under noImplicitAny.

What this error means

Type-checking fails with TS7031 naming a destructured binding, often a React props parameter.

tsc
src/Button.tsx(3,17): error TS7031: Binding element 'label' implicitly has an 'any' type.

Common causes

How to fix it

Type the destructured parameter

  1. Annotate the whole parameter object
ts
function Button({ label }: { label: string }) {}

Use a named props type

  1. Declare a Props interface and annotate the component with it
ts
interface Props { label: string }
function Button({ label }: Props) {}

How to prevent it

  • Always type the full parameter object when destructuring; do not annotate the bindings individually.

Related guides

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