Interface ElementsRule<T>

A rule definition for a list of elements.

interface ElementsRule<T> {
    __invariant?: Invariant<T>;
    localPart: undefined | string;
    maxOccurs: null | number;
    minOccurs: number;
    namespaceUri: Maybe<string>;
    rules: XmlRules<NonNullable<T>[number]>;
    type: ELEMENTS;
    useEmptyArrays: boolean;
}

Type Parameters

  • T extends readonly object[] | undefined

Hierarchy

Properties

__invariant?: Invariant<T>

Prevents rule from losing nullable type information.

localPart: undefined | string

Matches the QName.localPart of the element. If undefined, this will match against the property name from XmlRules.

maxOccurs: null | number

The maximum number of elements. Use null for unbounded.

minOccurs: number

The minimum number of elements.

namespaceUri: Maybe<string>

Matches the namespaceUri of the element or attribute.

If null, this will only match against a null namespace. If undefined, this will default to the namespace of the parent element for elements, or null for attributes.

Note that attributes do not inherit default namespaces as elements do.

rules: XmlRules<NonNullable<T>[number]>

Returns the schema for matched elements. These rules will be applied per element, collecting into an array.

type: ELEMENTS
useEmptyArrays: boolean

If true and there are 0 occurrences of the element, the parsed value will be an empty array instead of undefined.