Documentation
    Preparing search index...

    Type Alias MaxItems<Value>

    MaxItems: tags.TagBase<
        {
            exclusive: true;
            kind: "maxItems";
            schema: { maxItems: Value };
            target: "array";
            validate: `$input.length <= ${Value}`;
            value: Value;
        },
    >

    Array maximum items constraint.

    MaxItems<N> is a type tag that validates array values have at most the specified number of elements. Apply it to array properties using TypeScript intersection types.

    This constraint is commonly combined with MinItems to define a valid size range. It can also be combined with UniqueItems to require unique elements.

    The constraint is enforced at runtime by typia.is(), typia.assert(), and typia.validate(). It generates maxItems in JSON Schema output.

    Type Parameters

    • Value extends number

      Maximum number of elements allowed

    Jeongho Nam - https://github.com/samchon

    interface Upload {
    // Maximum 5 files per upload
    files: (File & MaxItems<5>)[];
    }
    interface Config {
    // Between 1-3 backup servers allowed
    backupServers: (Server & MinItems<1> & MaxItems<3>)[];
    }