bupkis
    Preparing search index...

    Type Alias MapExpectSlots<Parts>

    MapExpectSlots: Parts extends readonly [
        infer First extends AssertionPart,
        ...(infer Rest extends readonly AssertionPart[]),
    ]
        ? readonly [
            AssertionSlot<First> extends PhraseLiteralSlot<infer StringLiteral>
                ? Negation<StringLiteral> | StringLiteral
                : AssertionSlot<First> extends PhraseLiteralChoiceSlot<
                    infer StringLiterals,
                >
                    ? ArrayValues<StringLiterals>
                    | Negation<ArrayValues<StringLiterals>>
                    : AssertionSlot<First> extends z.ZodType
                        ? z.core.output<AssertionSlot<First>>
                        : never,
            ...MapExpectSlots<Rest>,
        ]
        : readonly []

    Maps AssertionParts to the corresponding argument types for expect and expectAsync functions.

    This utility type transforms assertion parts into the actual parameter types that users provide when calling expect functions. It handles both phrase literals and Zod schemas, creating appropriate TypeScript types for each slot.

    For phrase literals, it creates union types that include both the original phrase and its negated version (with "not " prefix). For Zod schemas, it extracts the inferred type. This enables natural language assertions with optional negation support.

    Type Parameters

    • Parts extends readonly AssertionPart[]

      Tuple of assertion parts to be converted to function parameter types

    This type works recursively through the parts tuple, transforming each part according to its type. The resulting tuple maintains the same structure as the input but with user-facing TypeScript types instead of internal assertion part types.

    // Given parts: ['to be a', z.string()]
    // Results in: ['to be a' | 'not to be a', string]
    type Slots = MapExpectSlots<['to be a', z.string()]>;
    // Usage: expect(value, 'to be a', 'hello') or expect(value, 'not to be a', 'hello')
    • SlotsFromParts for the complete slot transformation including subject injection
    • Negation for how phrase negation is implemented