# TSR1401: Value from external source '…' must be parsed before use: write 'parse<T>(…)' with the type you expect.

> A value from JSON.parse, res.json() or another external source is used without validation. Parse it with parse<T>() first.

## What it means

Values from outside the program (`JSON.parse`, `.json()` on `Response`, `MessageEvent.data`, server request bodies) are typed `unknown` in sound files until parsed. They may be stored as `unknown` and narrowed with `typeof`, `instanceof`, `in` and equality checks; any other use (property access, a call, assignment to a typed target, a typed return, spread, destructuring or a type assertion) is reported.

## Example

```ts
// Destructuring an external value reads properties off it.
const { theme } = JSON.parse('{"theme":"dark"}'); // @expect TSR1401
export const t: unknown = theme;
```

## How to fix

- Validate it: `const user = parse<User>(JSON.parse(text))`, or `fetchJson<User>(url)`.
- Use `safeParse<T>` to get a result instead of an exception.
- Keep it `unknown` and narrow it by hand.

Sound mode is defined in [design record 0007](https://github.com/Webb-Ventures/typescript-rust/blob/main/docs/design/0007-sound-mode.md) (accepted 2026-10-15).

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