BUPKIS
    Preparing search index...

    Variable objectKeyAssertionConst

    objectKeyAssertion: AssertionFunctionSync<
        readonly [
            ZodCustom<
                Record<PropertyKey, unknown>
                | ((...args: any[]) => any),
                Record<PropertyKey, unknown> | ((...args: any[]) => any),
            >,
            readonly [
                "to have key",
                "to have property",
                "to have prop",
                "to contain key",
                "to contain property",
                "to contain prop",
                "to include key",
                "to include property",
                "to include prop",
            ],
            ZodType<string, unknown, $ZodTypeInternals<string, unknown>>,
        ],
        (
            subject: Record<PropertyKey, unknown> | ((...args: any[]) => any),
            keypath: string,
        ) => { actual: string; expect: string; message: string } | undefined,
        readonly [
            ZodCustom<
                Record<PropertyKey, unknown>
                | ((...args: any[]) => any),
                Record<PropertyKey, unknown> | ((...args: any[]) => any),
            >,
            PhraseLiteralChoiceSlot<
                readonly [
                    "to have key",
                    "to have property",
                    "to have prop",
                    "to contain key",
                    "to contain property",
                    "to contain prop",
                    "to include key",
                    "to include property",
                    "to include prop",
                ],
            >,
            ZodType<string, unknown, $ZodTypeInternals<string, unknown>>,
        ],
    > = ...

    Asserts that an object has a property at the specified keypath using dot or bracket notation. Uses the has() function to traverse nested properties and supports complex keypaths like 'foo.bar[0]["baz"]'.

    This assertion supports:

    • Dot notation: 'prop.nested'
    • Bracket notation with numbers: 'arr[0]'
    • Bracket notation with quoted strings: 'obj["key"]' or "obj['key']"
    • Mixed notation: 'data.items[1].name'
    const obj = {
    foo: { bar: [{ baz: 'value' }] },
    'kebab-case': 'works',
    };

    expect(obj, 'to have key', 'foo.bar'); // passes
    expect(obj, 'to have property', 'foo.bar[0].baz'); // passes
    expect(obj, 'to have prop', 'foo["kebab-case"]'); // passes
    expect(obj, 'to have key', 'nonexistent.path'); // fails

    object-to-have-key-string-number-symbol

    object