The Template, Projection, or Placeholders value to
rewrite, typically inferred from an inline template literal via typeof
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
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:
readonly [I, Selection?]placeholders to homogeneous arraysreadonly I[], rewriting the element recursively and discarding the optional SelectionPropagates
undefinedand other union members through TypeScript's conditional-type distribution, preserving the nullability of undefined-able fields (bothundefined-union (v: undefined | T) and optional (v?: T) forms) without an explicit branch in the rewrite.