Skip to content
TS7006

    ↑↓ move · ⏎ open · esc close

    TS7006

    Parameter implicitly has an any type

    Parameter 'value' implicitly has an 'any' type.

    The compiler’s own words. Not translated — this is the string you pasted into a search box.

    Strict mode found a function parameter with no annotation and no surrounding context from which to infer one.

    Reproduction

    function double(value) {
      return value * 2
    }

    The build asserts this emits exactly this code.

    Why the compiler says this

    An untyped parameter is an unchecked entrance to the function. With `noImplicitAny`, TypeScript refuses to let callers send anything through that entrance unless the contract says what belongs there.

    Fixes

    1. 01
      function double(value: number) {
        return value * 2
      }

      Annotate the concrete input when the operation really requires a number.

    2. 02
      function identity<T>(value: T): T {
        return value
      }

      Use a type parameter when the function preserves whatever type the caller supplies.

    Takeaway

    Do not replace an implicit `any` with an explicit one by reflex. Describe the real input, or model the relationship with a generic.

    Where to go next

    Errors