BUPKIS
    Preparing search index...

    Variable AnySetSchemaConst

    AnySetSchema: ZodUnion<
        [
            ZodCustom<Set<unknown>, Set<unknown>>,
            ZodCustom<WeakSet<WeakKey>, WeakSet<WeakKey>>,
        ],
    > = ...

    Schema that matches either Set or WeakSet instances.

    This unified schema handles both strong and weak Set types, making it useful for assertions that should work with either variant. The distinction between Set and WeakSet is important for garbage collection behavior but often irrelevant for structural assertions.

    Key Differences Between Set and WeakSet:

    • Set: Holds strong references, prevents GC, iterable, any value types
    • WeakSet: Holds weak references, allows GC, not iterable, object keys only

    Usage Scenarios:

    • Generic containment checks that work with both types
    • Polymorphic collection handling in assertion libraries
    • APIs that accept either Set variant for flexibility

    WeakSet Limitations:

    • Only accepts object or symbol values (primitives will cause runtime errors)
    • Cannot be iterated or have size checked
    • Some Set-specific assertions may not work with WeakSet
    // Accepts both Set and WeakSet
    AnySetSchema.parse(new Set([1, 2, 3])); // ✓ passes
    AnySetSchema.parse(new WeakSet([obj1, obj2])); // ✓ passes
    AnySetSchema.parse(new Map()); // ✗ fails (wrong collection type)

    // Usage in assertions
    expect(myWeakSet, 'to contain', someObject); // Works with WeakSet
    expect(mySet, 'to contain', 'string'); // Works with Set