@supabase/middleware - v0.4.0
    Preparing search index...

    Type Alias ValidateEntries<Entries, Ctx>

    ValidateEntries: Entries extends readonly [
        Entry<infer Key, infer In, infer Contribution>,
        ...(infer Rest),
    ]
        ? IsAny<Ctx> extends true
            ? ValidateEntries<Rest, Ctx & { [P in Key]: Contribution }>
            : Key extends keyof Ctx
                ? Conflict<Key>
                : keyof In extends keyof Ctx
                    ? ValidateEntries<Rest, Ctx & { [P in Key]: Contribution }>
                    : `middleware-prereq: key '${Extract<
                        Exclude<keyof In, keyof Ctx>,
                        string,
                    >}' is not yet on the context (check ordering)`
        : true

    Validate a tuple of entries in order against a seed context. Each entry's prerequisites (In) must be present on the context accumulated so far, and its key must not already be there. Resolves to true when the whole chain is valid, or to a descriptive error-string type naming the offending key.

    pipeline applies it seeded with BaseContext. A composing wrapper that puts its own keys on the context before the entries run should seed it with that context instead. Entries can then declare prerequisites on the wrapper's keys, and a collision with one of them fails to compile.

    Site it on the handler parameter, never on the entries tuple, so it does not disrupt const Entries tuple inference. Conflict documents why the parameter position is the one TypeScript prints:

    handler: [ValidateEntries<Entries, Seed>] extends [true]
    ? (req: Request, ctx: Accumulated) => Promise<Response>
    : ValidateEntries<Entries, Seed>

    Type Parameters