Decompose monolithic readme into docs/ directory structure
This commit is contained in:
33
docs/types/options.md
Normal file
33
docs/types/options.md
Normal file
@@ -0,0 +1,33 @@
|
||||
[Overview](../overview.md) | [Installation](../installation.md) | [Usage](../usage.md) | **Types** | [Values](../values/) | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md)
|
||||
|
||||
# Options
|
||||
|
||||
You can pass Json Schema options on the last argument of any given type. Option hints specific to each type are provided for convenience.
|
||||
|
||||
```typescript
|
||||
// String must be an email
|
||||
const T = Type.String({
|
||||
// const T = {
|
||||
format: "email", // type: 'string',
|
||||
}); // format: 'email'
|
||||
// }
|
||||
|
||||
// Number must be a multiple of 2
|
||||
const T = Type.Number({
|
||||
// const T = {
|
||||
multipleOf: 2, // type: 'number',
|
||||
}); // multipleOf: 2
|
||||
// }
|
||||
|
||||
// Array must have at least 5 integer values
|
||||
const T = Type.Array(Type.Integer(), {
|
||||
// const T = {
|
||||
minItems: 5, // type: 'array',
|
||||
}); // minItems: 5,
|
||||
// items: {
|
||||
// type: 'integer'
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
Back to [Home](../../readme.md)
|
||||
Reference in New Issue
Block a user