TS2322: Type is not assignable - in CI
You assigned a value whose type does not fit the declared type of the target.
What this error means
Type-checking fails with TS2322 at an assignment, a JSX prop, or a return statement, naming both types.
tsc
src/state.ts(8,3): error TS2322: Type 'string' is not assignable to type 'number'.Common causes
How to fix it
Make the value match the type
- Convert or narrow the value at the boundary instead of forcing it
- Reproduce with tsc --noEmit locally to confirm
ts
const count: number = Number(raw)Fix the declared type if it is wrong
- Widen the target type deliberately if it is too narrow (e.g. string | number)
- Update code to a dependency's new type shape
How to prevent it
- Run tsc --noEmit in CI, enable strict, and avoid blanket as/any casts that mask real assignment errors.
Related guides
TS2345: Argument is not assignable - in CIFix "error TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'" when tsc runs in CI - a t…
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…
TS2339: Property does not exist on type - in CIFix "error TS2339: Property 'x' does not exist on type 'Y'" when tsc runs in CI - accessing a member the type…