-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
array.ts
20 lines (20 loc) · 914 Bytes
/
array.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { NullableRules, UndefinableRules } from "../libs/publicTypes.ts";
import { ArraySchema, RulesForArray } from "../schemaClasses/ArraySchema.ts";
/** schema for array or null or undefined */
export function array<T>(options: RulesForArray<T> & NullableRules & UndefinableRules): ArraySchema<T, null | undefined>;
/** schema for array or undefined */
export function array<T>(options: RulesForArray<T> & UndefinableRules): ArraySchema<T, undefined>;
/** schema for array or null */
export function array<T>(rules: RulesForArray<T> & NullableRules): ArraySchema<T, null>;
/** schema for array */
export function array<T>(rules: RulesForArray<T>): ArraySchema<T>;
/** schema for array */
export function array<T>(): ArraySchema<T>;
/**
* create schema
* @param rules rules
* @returns schema
*/
export function array<T>(rules: RulesForArray<T> = {}): ArraySchema<T> {
return new ArraySchema<T>(rules);
}