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')
Converts
AssertionPartsto complete function parameter types for expect functions.This utility type prepares assertion parts for use as function parameters by applying several transformations:
unknowntype for the subject parameter if the first part is a phrase literalTypeScripttypes via MapExpectSlotsnevertypes to ensure a clean tuple structureThe 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.