@metreeca/blue - v0.9.1
    Preparing search index...

    Function boolean

    Creates a boolean shape.

    • Creates a boolean shape with a typed model value and no other constraints.

      Type Parameters

      • M extends boolean

        The literal boolean type for the model

      Parameters

      • model: M

        Prototype value for runtime model assembly

      Returns BooleanShape & { model: M }

      A shape with model typed as M

      const enabled = boolean(true as const);
      
    • Creates a boolean shape with optional model constraint.

      Parameters

      Returns BooleanShape

      A shape with model typed as boolean

      If constraints is not a valid BooleanConstraints

      const flag = boolean();
      const enabled = boolean({ model: true });