Skip to content
webtype.orgwebtype.orgtsconfig

    ↑↓ move · ⏎ open · esc close

    tsconfig

    noImplicitAny

    No silent opt-out

    A parameter the compiler cannot infer becomes `any` — this makes it say so instead.

    Since
    TypeScript 1.6
    strict
    In strict
    In your tsconfig
    "noImplicitAny": true

    The same snippet both times. Only the option changed.

    With it off

    "noImplicitAny": false
    export function twice(value) {
      return value
    }

    Compiles clean

    With it on

    "noImplicitAny": true
    export function twice(value) {
      return value
    }

    Emits TS7006

    Why the compiler bothers

    An `any` you wrote is a decision. An `any` the compiler handed you because it gave up is a hole nobody chose, and it propagates: everything touched by that value is unchecked from there on. The flag does not forbid `any` — it forbids the compiler from inserting one without telling you, which leaves the escape hatch exactly where it belongs, in the source, with your name on it.

    Takeaway

    Keep `any` available and keep it explicit. Those are the same setting.

    Where to go next

    22 options