• Error
  • Reported by the type checker

TS7032

Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation.

A `set` accessor's parameter has no type and there's no `get` to infer it from, so the property would be `any`. Annotate the parameter.

What it means

Under noImplicitAny, a property defined only by a setter takes its type from the setter's parameter. Without an annotation (and without a matching getter whose return type could be used) the property would be implicitly any.

Example

index.ts
export class Box {
  set value(v) {}
}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,7): error TS7032: Property 'value' implicitly has type 'any', because its set accessor lacks a parameter type annotation.
index.ts(2,13): error TS7006: Parameter 'v' implicitly has an 'any' type.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Annotate the parameter: set value(v: number) {}.
  • Or add a getter with a return type that the setter's parameter can take.