diff --git a/paseri-docs/src/content/docs/reference/Schema/common.mdx b/paseri-docs/src/content/docs/reference/Schema/common.mdx index 41bf7ab..e384d1f 100644 --- a/paseri-docs/src/content/docs/reference/Schema/common.mdx +++ b/paseri-docs/src/content/docs/reference/Schema/common.mdx @@ -97,3 +97,22 @@ if (result.ok) { // result.value is of type `bigint`. } ``` + +## Types + +### `Infer` + +You can use the `Infer` type to determine the result type of any schema. This is useful, because you don't want to +manually define a type that could easily get out of sync with the schema definition. + +```typescript +import * as p from '@vbudovski/paseri'; + +const schema = p.object({ + foo: p.string(), + bar: p.number(), +}) + +type MySchema = p.Infer; +// MySchema will be { foo: string, bar: number }. +```