@metreeca/qest - v0.10.0
    Preparing search index...

    Type Alias Instance<T>

    Instance: T extends readonly [infer I, Selection?]
        ? readonly Instance<I>[]
        : T extends object
            ? [Index<T>] extends [never] ? Slots<T> : Instance<T[Index<T>]>
            : T

    Infers the Resource type fetched by a Template.

    Recursively rewrites a template-shaped type into the corresponding Resource shape, so client code can declare strongly-typed result variables without restating the schema. Dispatches the rewrite by structural shape:

    • collection tuples — widens readonly [I, Selection?] placeholders to homogeneous arrays readonly I[], rewriting the element recursively and discarding the optional Selection
    • objects — maps properties homomorphically, rewriting each key through Name (which drops Selection constraint and pagination keys and extracts Binding identifiers) and rewrites each value recursively
    • primitives — passes Literal and Reference placeholders through unchanged

    Propagates undefined and other union members through TypeScript's conditional-type distribution, preserving the nullability of undefined-able fields (both undefined-union (v: undefined | T) and optional (v?: T) forms) without an explicit branch in the rewrite.

    Type Parameters

    const template: Template = {
    id: "",
    name: "",
    price: 0,
    tags: [""],
    vendor: { id: "", name: "" }
    };

    type ProductView = Instance<typeof template>;
    // → {
    // readonly id: Reference;
    // readonly name: string;
    // readonly price: number;
    // readonly tags: readonly string[];
    // readonly vendor: { readonly id: Reference; readonly name: string };
    // }

    Name for the per-key rewrite step