Skip to main content

$optional

Callable

  • $optional<T>(literal: T | () => T): OptionalType<T>

  • Create a new ThereforeNode instance with the given options.

    Example

    $object({
    foo: $optional($string)
    })

    Type parameters

    Parameters

    • literal: T | () => T

      The schema to make an optional property.

      Returns OptionalType<T>