# TS2322: Type '…' is not assignable to type '…'.

> A value is assigned to a variable, property or return type it doesn't fit. Change the value, or widen the declared type if the value is legitimate.

## What it means

A value of one type is used where another type is required, and the first isn't assignable to
the second. It's reported on assignments, variable initialisers, property values in object
literals, `return` statements and default values. When the mismatch is deep inside an object
type, the message has extra indented lines that walk down to the property that doesn't fit.

## Example

```ts
let count: number = 0;
count = "1";
```

## How to fix

- Convert the value: `count = Number("1")`, or parse it if it comes from outside the program.
- If the value is legitimately of both kinds, widen the declared type: `let count: number | string`.
- For object literals, read the indented lines of the message: the last one names the property
  that doesn't match.
- Avoid silencing it with `as`: an assertion tells the checker to trust you, and the runtime
  value is still wrong.

Source: https://ts-r.dev/errors/TS2322/
