How to Fix TypeScript Error TS2322: "Type 'X' is not assignable to type 'Y'"
The value being passed or assigned has a type shape incompatible with the declared variable or parameter type (such as string assigned to a literal union).
TS2322: Type is not assignable to type
Quick Fix Checklist
- Use "as const" on literal objects or variables to preserve specific union types
- Provide default fallback for optional values: name ?? ""
- Ensure function return types match contract declarations