• Sound mode parse<T>, pre-alpha
  • Design record 0007, Accepted

TSR1502

'{0}<{1}>' needs a concrete type, but '{1}' is a type parameter. Take a 'Guard<{1}>' argument and call 'guard<User>()' at the call site.

parse<T> is called with a type parameter, which has no concrete type to validate. Take a Guard<T> argument and call guard<User>() at the call site.

Rule parse<T>: parse<T> validators. Reported by ts-r-check and ts-r-lsp in files that opt in to sound mode. See Sound mode.

What it means

Validators are generated from declarations at build time, so inside generic code parse<T> has no concrete type to validate.

Example

Spec case from design record 0007 (checked by the record's case harness, not by this site's build)
// parse<T> inside generic code has no concrete type to validate.
import { parse } from "@ts-r.dev/guard";

function load<T>(raw: unknown): T {
  return parse<T>(raw); // @expect TSR1502
}
export const n: number = load<number>(1);

How to fix

  • Take a Guard<T> parameter and call its parse; at the call site pass guard<User>().

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