TypeScript
Argument is not assignable to the parameter type
Argument of type '{0}' is not assignable to parameter of type '{1}'.TypeScript found a function call where the provided argument type does not match the parameter type.
Observed message
Argument of type '{0}' is not assignable to parameter of type '{1}'.Why it happens
- A function is being called with a value whose type does not match the declared parameter type.
- A union value is passed to a function before TypeScript can narrow it to the required member type.
- A third-party type definition or generic constraint is stricter than the value being passed.
How to fix it
- Pass a value that matches the declared parameter type.
- Add narrowing logic before the function call so TypeScript can prove the argument is valid.
- Review the function signature, generic constraints, or external type definitions if the current typing is too restrictive.