API reference › @evolu/common › Type › InferType
type InferType<T> = T["Output"];
Defined in: packages/common/src/Type.ts:1287
Extracts the Output of a Type.
Use it to declare a named object Type Output as an interface. TypeScript then preserves the interface name in tooltips and error messages instead of expanding all of its properties.
Example
import {
NonEmptyTrimmedString100,
PositiveInt,
object,
optional,
type InferType,
} from "@evolu/common";
const User = object({
name: NonEmptyTrimmedString100,
age: optional(PositiveInt),
});
interface User extends InferType<typeof User> {}