• Sound mode S-14, pre-alpha
  • Design record 0007, Accepted

TSR1402

'{0}' needs an explicit type argument in sound mode, e.g. '{0}<User>(...)'.

A @ts-r.dev/guard helper such as parse or fetchJson is called without a type argument. Write the type you expect: parse<User>(...).

Rule S-14: Data from outside the program is typed `unknown` until parsed (level: sound). Reported by ts-r-check and ts-r-lsp in files that opt in to sound mode. See Sound mode.

What it means

The typed helpers from @ts-r.dev/guard (parse, fetchJson and the others) build a validator from their type argument, so it must be written explicitly. It's reported at the call.

Example

Spec case from design record 0007 (checked by the record's case harness, not by this site's build)
// parse needs an explicit type argument.
import { parse } from "@ts-r.dev/guard";

const v = parse(JSON.parse("{}")); // @expect TSR1402
export const got: unknown = v;

How to fix

  • Add the type argument: parse<User>(value), fetchJson<User>("/api/user").

Sound mode is defined in design record 0007 (accepted 2026-10-15).