# TSR0102: '…' is 'unknown' in sound mode because '…' declares it as 'any'. Narrow it or parse it with 'parse<T>'.

> A value typed 'any' by a lib file, package or non-sound file is 'unknown' in sound mode. Narrow it or parse it with parse<T>.

## What it means

When a sound file reads a type declared outside the sound set (lib files, `.d.ts` files, packages, non-sound local files), each `any` in it becomes `unknown`. Using that value as a more specific type is reported here, where tsc would report the `unknown` misuse, and the message names the declaration that said `any`. Examples are `Reflect.get`, the `reason` of `Promise.prototype.catch` and `Array.isArray` narrowing to `any[]`.

## Example

```ts
// Reflect.get returns any in lib.
function port(config: object): number {
  const p: number = Reflect.get(config, "port"); // @expect TSR0102
  return p;
}
export const p: number = port({ port: 80 });
```

## How to fix

- Narrow the value with `typeof`, `instanceof`, `in` or equality checks before using it.
- Or validate it with `parse<T>(value)` from `@ts-r.dev/guard`.
- Annotate callback parameters as `unknown` (`p.catch((e: unknown) => report(e))`) and narrow inside.

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/TSR0102/
