General

TypeScript Error Codes Explained: TS2345, TS2322, TS2339 and Friends

2026-10-29 · 8 min · Lint Team

TypeScript produces hundreds of numbered diagnostics, but the ones that stop most builds are a handful of shape mismatches. Once you can read the shape, the number stops mattering.

TS2345: the argument does not fit the parameter


Argument of type X is not assignable to parameter of type Y. The compiler is not comparing your intention, it is comparing the declared type of the value you passed against the declared type of the parameter. Two causes cover most cases: the value is wider than the parameter (a string where a union of literals is expected), or an optional property is undefined where the parameter requires it.

The fix order that works


  • Check the parameter type first. If the callee genuinely accepts less, the caller must narrow before calling.

  • Narrow at the source rather than at the call site. A guard where the value is created beats a cast at every call.

  • Only then consider a cast, and only with a comment explaining which invariant makes it safe.


  • TS2322: assignment, not argument


    Type X is not assignable to type Y shows up on assignments, property initialisers, and return statements. The difference from TS2345 is only position. Because it fires on assignment, the fix usually belongs in the type definition rather than in the expression: an interface declares id: string while the data layer produces number.

    TS2339: this property does not exist here


    Property does not exist on type X is the most misread code in the language. It almost always means the type is not the type you think it is. Three real causes in order of frequency: the value is a union and only one member has the property; the type is unknown after a parse or a catch; the interface is missing a field the API actually returns.

    The codes that come from strict mode


    TS18046 (is of type unknown) comes from catch variables and JSON.parse. TS2532 and TS18048 (possibly undefined) come from optional properties and array indexing. Both are the compiler telling you where a real runtime crash lives. Silencing them with a non-null assertion moves the crash to production, which is where it costs the most.

    Casts, assertions, and the honest middle


    as does not convert anything at runtime, it only reinterprets. satisfies checks a value against a type without widening it, and it is usually what people reach for as to do. A type guard is the only option that survives a refactor.

    Where a decoder helps


    TypeScript diagnostics are long, and the useful part is buried under three lines of type printing. Lint's Error Decoder takes the raw diagnostic and returns which code fired, what shape mismatch it describes, and the standard fix for that code. Paste the red text from your terminal, not a screenshot — the type printer output is the part that matters.

    Frequently Asked Questions



    Q: Is TS2345 the same as TS2322?
    Functionally yes. TS2345 fires on call arguments, TS2322 on assignments and returns. The underlying question is identical: does this value fit that declared type.

    Q: Should I just use any to unblock the build?
    Every any removes the compiler from the one place you needed it. Use unknown plus a narrowing guard, or fix the type definition. The build stays green either way, but only one of them stays green after the next refactor.

    Q: Why does the error point at a file I did not change?
    Because a shared type changed, or an inferred return type widened. Check the type definition files and library upgrades before editing the reported file.

    Q: Can I decode an error from a screenshot?
    Yes if you have no text copy. Lint's OCR tool extracts the text first, then the decoder reads the pattern. Text is always more reliable than an image.
    📌 Prices and tool count in this article may be outdated. Lint now ships 16 tools with Pro at $12/mo, or $60/year. See the current pricing page.
    Try Lint free — no signup, code-aware
    Free · no account needed · open full toolkit →
    L
    Lint Team
    Lint Tools — AI writing for developers

    Stop letting Grammarly break your code

    17 AI tools built for developers. Code-aware parsing.

    Try free — no signup View pricing
    Or upgrade to Pro for 500 checks a day · All tools · No ads

    Need more than free tools?

    Unlock 500 checks a day, larger text capacity, and priority support.

    View pricing → Upgrade Lint — Pro $12/mo or $60/yr
    💬