@metreeca/blue - v0.10.0
    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 }

      An immutable shape with model typed as M

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

      Parameters

      Returns BooleanShape

      An immutable shape with model typed as boolean

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