functional-models
    Preparing search index...

    Interface PropertyInstance<TValue, TData, TModelExtensions, TModelInstanceExtensions>

    An instance of a property. This is used to describe a property in depth as well as provide functionality like validating values.

    interface PropertyInstance<
        TValue extends Arrayable<DataValue>,
        TData extends DataDescription = DataDescription,
        TModelExtensions extends object = object,
        TModelInstanceExtensions extends object = object,
    > {
        createGetter: (
            value: TValue,
            modelData: TData,
            modelInstance: ModelInstance<
                TData,
                TModelExtensions,
                TModelInstanceExtensions,
            >,
        ) => ValueGetter<TValue, TData, TModelExtensions, TModelInstanceExtensions>;
        getChoices: () => readonly ChoiceTypes[];
        getConfig: () => object;
        getConstantValue: () => undefined | TValue;
        getDefaultValue: () => undefined | TValue;
        getPropertyType: () => string;
        getValidator: (
            valueGetter: ValueGetter<
                TValue,
                TData,
                TModelExtensions,
                TModelInstanceExtensions,
            >,
        ) => PropertyValidator<TData>;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    createGetter: (
        value: TValue,
        modelData: TData,
        modelInstance: ModelInstance<
            TData,
            TModelExtensions,
            TModelInstanceExtensions,
        >,
    ) => ValueGetter<TValue, TData, TModelExtensions, TModelInstanceExtensions>

    Creates a value getter.

    Type declaration

    getChoices: () => readonly ChoiceTypes[]

    Gets available choices for limiting the value of this property.

    getConfig: () => object

    Gets the configuration passed into the property constructor.

    getConstantValue: () => undefined | TValue

    If there is a constant value that never changes. (This is used above all else).

    getDefaultValue: () => undefined | TValue

    If there is a default value

    getPropertyType: () => string

    Gets the ValueType of the property. Unless custom properties are used, the value is a PropertyType. Otherwise the value could be string for custom types.

    getValidator: (
        valueGetter: ValueGetter<
            TValue,
            TData,
            TModelExtensions,
            TModelInstanceExtensions,
        >,
    ) => PropertyValidator<TData>

    Gets a validator for the property. This is not normally used. Instead for validation look at ModelInstance.validate

    Type declaration