Type Alias: InferModelOutput<M>
InferModelOutput<
M
> =StandardSchemaV1.InferOutput
<M
["schema"
]>
Defined in: packages/model/src/types.ts:29
Infers the output type of a model created with createModel
.
Type Parameters
M
M
extends object
Type of the model object containing a schema property
Example
typescript
import { createModel, InferModelOutput } from '@uni-ts/model';
import { z } from 'zod';
const User = createModel(z.object({
name: z.string().min(1),
email: z.string().email(),
}));
// Infer the type from the model
type User = InferModelOutput<typeof User>; // { name: string; email: string }
function processUser(user: User) {
// user is guaranteed to have name and email properties
console.log(user.name, user.email);
}