Aller au contenu principal

Infer<S>

Infer<S> = S extends Schema<infer T> ? T : never

Extracts the inferred TypeScript type from a Kanon schema.


Type Parameters

S: S

The schema type to extract from


Since

2.0.0


Example

const userSchema = object({ name: string(), age: number() });
type User = `Infer<typeof userSchema>`;
// ^? { name: string; age: number }