@metreeca/type - v0.1.1
    Preparing search index...

    Function anObject

    An object guard factory.

    Key guard or property schema

    Value guard (key guard mode) or guard for unlisted properties (schema mode)

    • An object guard factory without property validation.

      The returned guard checks if a value is a plain object.

      Type Parameters

      • T extends Object<unknown>

        The object type

      Returns Guard<T>

    • An object guard factory with key and value guards.

      The returned guard checks if a value is a plain object and validates each key and value using the provided guards.

      Type Parameters

      • K extends PropertyKey

        The key type

      • V

        The value type

      Parameters

      Returns Guard<Record<K, V>>

    • An object guard factory with schema-based property validation.

      The returned guard checks if a value is a plain object and validates each property against the schema.

      • If rest is omitted, the object is closed: unlisted properties are rejected
      • If rest is provided, the object is open: unlisted properties are validated with the rest guard

      Type Parameters

      Parameters

      • schema: T

        Schema mapping property names to guards or literal values

      • Optionalrest: Guarding<unknown>

        Guard for validating unlisted properties (open object) or omit to reject them (closed object)

      Returns Guard<Entries<T>>