diff --git a/README.md b/README.md index 696b94386..3c67df83d 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ This docs have been translated into [Chinese](./README_ZH.md). - [.strip](#strip) - [.catchall](#catchall) - [Arrays](#arrays) + - [.element](#element) - [.nonempty](#nonempty) - [.min/.max/.length](#minmaxlength) - [Tuples](#tuples) @@ -814,6 +815,14 @@ z.string().optional().array(); // (string | undefined)[] z.string().array().optional(); // string[] | undefined ``` +### `.element` + +Use `.element` to access the schema for an element of the array. + +```ts +stringArray.element; // => string schema +``` + ### `.nonempty` If you want to ensure that an array contains at least one element, use `.nonempty()`.