BUPKIS
    Preparing search index...

    Variable MapSchemaConst

    MapSchema: ZodCustom<Map<unknown, unknown>, Map<unknown, unknown>> = ...

    Schema that matches any Map instance, including those with any key-value types.

    This schema provides runtime type checking for Map instances without requiring compile-time knowledge of key or value schemas. It uses instanceof checking to verify Map structure while being agnostic about the contained data types.

    Usage in Assertions:

    • Size validation: expect(myMap, 'to have size', 5)
    • Key presence: expect(myMap, 'to have key', 'someKey')
    • Value containment: expect(myMap, 'to have value', expectedValue)
    • Entry validation: expect(myMap, 'to have entry', [key, value])
    • Map equality: expect(mapA, 'to equal', mapB)

    Advantages Over z.map():

    • Works with Maps having heterogeneous key/value types
    • No need to specify key and value schemas upfront
    • Optimized for structural validation rather than content parsing
    • Better error messages for type mismatches in assertions
    // Matches any Map regardless of key/value types
    MapSchema.parse(new Map([['key', 'value']])); // ✓ passes
    MapSchema.parse(
    new Map([
    [1, 'one'],
    [2, 'two'],
    ]),
    ); // ✓ passes
    MapSchema.parse(new Map()); // ✓ passes (empty Map)
    MapSchema.parse({}); // ✗ fails (plain object)
    MapSchema.parse(new WeakMap()); // ✗ fails (use AnyMapSchema)