bupkis
    Preparing search index...

    Type Alias SlotsFromParts<Parts>

    SlotsFromParts: NoNeverTuple<
        Parts extends readonly [infer First extends AssertionPart, ...(infer _)]
            ? First extends PhraseLiteral
            | PhraseLiteralChoice
                ? [unknown, ...MapExpectSlots<Parts>]
                : MapExpectSlots<Parts>
            : never,
    >

    Converts AssertionParts to complete function parameter types for expect functions.

    This utility type prepares assertion parts for use as function parameters by applying several transformations:

    1. Injects an unknown type for the subject parameter if the first part is a phrase literal
    2. Maps the remaining parts to their corresponding TypeScript types via MapExpectSlots
    3. Filters out never types to ensure a clean tuple structure

    The subject injection is a key feature - when assertions start with phrases like "to be a string", users still need to provide the subject being tested as the first argument to expect functions.

    Type Parameters

    • Parts extends AssertionParts

      Tuple of assertion parts that define the assertion structure

    This type is essential for bridging the gap between assertion definitions and user-facing function signatures. The subject injection ensures that all assertions have a consistent calling pattern regardless of whether they explicitly define a subject parameter.

    // Assertion parts: ['to equal', z.string()]
    // Results in: [unknown, 'to equal' | 'not to equal', string]
    type Slots = SlotsFromParts<['to equal', z.string()]>;

    // Usage: expect(subject, 'to equal', 'expected')
    // expect(subject, 'not to equal', 'unexpected')