Function any

  • Creates the unconstrained shape.

    You can specify compile-time type to enhance type inference.

    This provides no runtime type-safety!

    Type Parameters

    • Value = any

      The input and the output value.

    Returns Shape<Value>

  • Creates the shape that is constrained with a narrowing predicate.

    Type Parameters

    • Value

      The input and the output value.

    Parameters

    • cb: ((value: any, options: ParseOptions) => value is Value)

      The type predicate that returns true if value conforms the required type, or false otherwise.

    • Optionaloptions: Message | RefineOptions

      The issue options or the issue message.

    Returns Shape<Value>

    The shape that has the narrowed output.

  • Creates the shape that is constrained with a predicate.

    Type Parameters

    • Value = any

      The input and the output value.

    Parameters

    • cb: ((value: any, options: ParseOptions) => boolean)

      The predicate that returns truthy result if value is valid, or returns falsy result otherwise.

        • (value, options): boolean
        • Parameters

          Returns boolean

    • Optionaloptions: Message | RefineOptions

      The issue options or the issue message.

    Returns Shape<Value>