@salesforce/ts-types
    Preparing search index...

    Function coerceJsonArray

    • Narrows an array of type T to a JsonArray using a shallow type-compatibility check. Use this when the source of the array is known to be JSON-compatible and you want simple type coercion to a JsonArray. Use toJsonArray instead when the value array cannot be guaranteed to be JSON-compatible and you want an assurance of runtime type safety. This is a shortcut for writing asJsonArray(coerceAnyJson(value)).

      Type Parameters

      • T

      Parameters

      Returns Optional<JsonArray>

    • Narrows an array of type T to a JsonArray using a shallow type-compatibility check. Use this when the source of the array is known to be JSON-compatible and you want simple type coercion to a JsonArray. Use toJsonArray instead when the value array cannot be guaranteed to be JSON-compatible and you want an assurance of runtime type safety. This is a shortcut for writing asJsonArray(coerceAnyJson(value)) ?? defaultValue.

      Type Parameters

      • T

      Parameters

      • value: Nullable<T[]>

        The array to coerce.

      • defaultValue: JsonArray

        The default to return if value was not defined.

      Returns JsonArray