• Assert that a value is valid according to a struct.

    It is similar to superstruct's mask function, but it does not ignore extra properties.

    Type Parameters

    • Type
    • Schema

    Parameters

    • value: unknown

      Value to check.

    • struct: Struct<Type, Schema>

      Struct to validate the value against.

    • Optional message: string

      Error message to throw if the value is not valid.

    Returns Type

    The value if it is valid.