Function ucOptional

  • Creates a schema for the given data type that allows undefined values.

    Type Parameters

    • T

      Implied data type.

    Parameters

    • type: UcDataType<T>

      Original data type.

    • Optional optional: true
      Optional

    Returns UcOptional<T, UcSchema<T>>

    Schema instance.

  • Modifies data model to allow undefined values.

    Type Parameters

    • T

      Implied data type.

    • TSchema extends UcSchema<T> = UcSchema<T>

      Original schema type.

    Parameters

    • model: UcModel<T, TSchema>

      Model to modify.

    • Optional optional: true
      Optional

    Returns UcOptional<T, TSchema>

    Modified schema or original one if it is already optional.

  • Creates a schema for the given data type that prohibits undefined values.

    Type Parameters

    • T

      Implied data type.

    Parameters

    • type: UcDataType<T>

      Original data type.

    • optional: false

    Returns UcRequired<T, UcSchema<T>>

    Schema instance.

  • Modifies data model to prohibit undefined values.

    Type Parameters

    • T

      Implied data type.

    • TSchema extends UcSchema<T> = UcSchema<T>

      Original schema type.

    Parameters

    • model: UcModel<T, TSchema>

      Model to modify.

    • optional: false

    Returns UcRequired<T, TSchema>

    Modified schema or original one if it prohibits undefined values already.

  • Creates a schema for the given data type that allows or prohibits undefined values.

    Type Parameters

    • T

      Implied data type.

    • TOptional extends undefined | boolean = true

      Type of optional flag.

    Parameters

    • type: UcDataType<T>

      Original data type.

    • optional: TOptional

      Whether to allow undefined values.

    Returns UcOptional<T, UcSchema<T>, TOptional>

    Schema instance.

  • Modifies data model to allow or prohibit undefined values.

    Type Parameters

    • T

      Implied data type.

    • TSchema extends UcSchema<T> = UcSchema<T>

      Original schema type.

    • TOptional extends undefined | boolean = true

      Type of optional flag.

    Parameters

    • model: UcModel<T, TSchema>

      Model to modify.

    • optional: TOptional

      Whether to allow undefined values.

    Returns UcOptional<T, TSchema, TOptional>

    Modified schema or original one if its optional constraint matches the requested one.

Generated using TypeDoc