Skip to content

Variable: t

ts
const t: {
  array: <T>(item) => ZodArray<T, "many">;
  boolean: ZodBoolean;
  date: ZodDate;
  enum: <V>(...values) => ZodEnum<[V, ...V[]]>;
  nullable: <T>(type) => ZodNullable<T>;
  number: ZodNumber;
  object: <T>(shape) => ZodObject<T, "strip", ZodTypeAny, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<T>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<T>[k] }>;
  optional: <T>(type) => ZodOptional<T>;
  record: <T>(valueType) => ZodRecord<ZodString, T>;
  string: ZodString;
  zod: __module;
};

Defined in: packages/core/src/presenter/typeHelpers.ts:50

Compact type namespace for Presenter schema definitions.

Eliminates import { z } from 'zod' for 95% of use cases. Every value is a real ZodType — .describe(), .optional(), .nullable(), .default() all work natively.

Type Declaration

NameTypeDefault valueDescriptionDefined in
array()<T>(item) => ZodArray<T, "many">-Create an array type. Example t.array(t.string) // z.array(z.string()) t.array(t.number) // z.array(z.number())packages/core/src/presenter/typeHelpers.ts:93
booleanZodBoolean-Boolean type — equivalent to z.boolean()packages/core/src/presenter/typeHelpers.ts:60
dateZodDate-Date type — equivalent to z.date()packages/core/src/presenter/typeHelpers.ts:63
enum()<V>(...values) => ZodEnum<[V, ...V[]]>-Create an enum type from string literals. Example t.enum('active', 'archived') // z.enum(['active', 'archived'])packages/core/src/presenter/typeHelpers.ts:78
nullable()<T>(type) => ZodNullable<T>-Make a type nullable. Example t.nullable(t.string) // z.string().nullable()packages/core/src/presenter/typeHelpers.ts:152
numberZodNumber-Number type — equivalent to z.number()packages/core/src/presenter/typeHelpers.ts:57
object()<T>(shape) => ZodObject<T, "strip", ZodTypeAny, { [k in string | number | symbol]: addQuestionMarks<baseObjectOutputType<T>, any>[k] }, { [k in string | number | symbol]: baseObjectInputType<T>[k] }>-Create a nested object type. Example t.object({ lat: t.number, lng: t.number }) // z.object({...})packages/core/src/presenter/typeHelpers.ts:107
optional()<T>(type) => ZodOptional<T>-Make a type optional. Example t.optional(t.string) // z.string().optional() t.optional(t.number) // z.number().optional()packages/core/src/presenter/typeHelpers.ts:138
record()<T>(valueType) => ZodRecord<ZodString, T>-Create a record (dictionary) type. Example t.record(t.string) // z.record(z.string())packages/core/src/presenter/typeHelpers.ts:121
stringZodString-String type — equivalent to z.string()packages/core/src/presenter/typeHelpers.ts:54
zod__modulezDirect access to Zod for advanced use cases. Use when t.* helpers don't cover your needs: regex, transforms, refinements, unions, discriminated unions, etc. Example .schema({ id: t.string, email: t.zod.string().email().min(5), // Zod power features role: t.zod.union([t.zod.literal('admin'), t.zod.literal('user')]), })packages/core/src/presenter/typeHelpers.ts:172

Example

typescript
.schema({
    id:     t.string,
    count:  t.number,
    active: t.boolean,
    role:   t.enum('admin', 'user', 'guest'),
    tags:   t.array(t.string),
})