Error AtlasError Documentation and Resolution

TypeScript found an argument that is not assignable to the parameter type

error TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'.

TypeScript rejected a function call because one of the provided arguments does not match the type expected by the target parameter.

error TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'.
  • The argument value has a different shape or primitive type than the function expects.
  • A union or generic value is broader than the accepted parameter type.
  • The function signature changed but the calling code was not updated.
  1. Inspect the function signature and compare it with the value being passed.
  2. Transform or narrow the argument before calling the function if needed.
  3. Only broaden the function signature if the wider input is genuinely valid.
TypeScript Docs: TypeScript for JavaScript Programmers
TS2345 Argument of type is not assignable to parameter of type: causes and fixes | Error Atlas