Infer
@tsed/schema
Usage
typescript
import { Infer } from "@tsed/specs/schema/src/domain/types";Overview
ts
type Infer<S> = S extends JsonSchema<infer T> ? T : never;Description
Extracts the inferred TypeScript type from a JsonSchema.
This utility type enables type-safe schema usage by extracting the type parameter from JsonSchema instances.
Usage
typescript
const userSchema = JsonSchema.from({ type: "object" });
type User = Infer<typeof userSchema>; // Extracts the type