• Obtain a native JS default value for a ValueModel.

    This code assumes defaults have been previously validated (e.g. by model validator). It throws errors for a few structural issues but generally returns undefined if the model's default value cannot be converted to the correct type.

    Parameters

    • model: ValueModel<ValueElement>

      the model from which the default value is extracted

    • OptionalifValid: boolean

      some structs only have partial defaults defined so would be invalid; do not return these

    Returns any