TS2345: Argument is not assignable - in CI
You passed an argument whose type does not match the parameter a function expects.
What this error means
Type-checking fails with TS2345 at a call site, naming the argument type and the expected parameter type.
tsc
src/cart.ts(18,14): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.Common causes
How to fix it
Make the argument match the parameter
- Convert or narrow the value before the call
- Avoid as casts that silence the error without fixing it
ts
addToCart(Number(productId))Fix the signature if the type is too narrow
- Widen the parameter type deliberately (e.g. string | number)
- Update calls to a dependency's new shape
How to prevent it
- Run tsc --noEmit in CI, enable strict, and convert at boundaries instead of casting.
Frequently asked questions
What causes "TS2345 argument not assignable"?
Type-checking fails with TS2345 at a call site, naming the argument type and the expected parameter type.
How do I fix TS2345 argument not assignable?
Make the argument match the parameter
Related guides
TS2322: Type is not assignable - in CIFix "error TS2322: Type 'X' is not assignable to type 'Y'" when tsc runs in CI - a genuine type mismatch on a…
TS2769: No overload matches this call - in CIFix "error TS2769: No overload matches this call" when tsc runs in CI - arguments do not fit any of a functio…
TS2554: Expected N arguments, but got M - in CIFix "error TS2554: Expected N arguments, but got M" when tsc runs in CI - a call with the wrong number of arg…