Skip to content

Commit

Permalink
chore(docs): add T.array().convert() to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkdev98 committed May 14, 2023
1 parent d3aabbd commit 9744e6c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/generators/build-structure/types-and-validators.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,18 @@ T.date().inThePast(); // Accept dates that represent a datetime in the past.
```ts
T.array().values(T.bool());
// -> Typescript type: boolean[]
// -> Valid validator inputs: true, [false]
// -> Valid validator inputs: [true], [false]
// -> Validator outputs: [true], [false]
// Note the auto conversion to array for the first input.

T.array().min(1); // Enforce a minimum number of items
T.array().max(5); // Enforce a maximum number of items

T.array().values(T.bool()).convert(); // Convert non-array values to an array
// -> Typescript input type: boolean|boolean[]
// -> Typescript output type: boolean[]
// -> Valid validator inputs: true, [false]
// -> Validator outputs: [true], [false]
// Note the auto conversion to array for the first input.
```

## Object
Expand Down

0 comments on commit 9744e6c

Please sign in to comment.