VariantFamilySpec
Interface in Variants
What variantFamily is given.
import type { VariantFamilySpec } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
interface VariantFamilySpec<A extends Record<string, readonly unknown[]>> { readonly axes: A; readonly build: (axes: AxisValues<A>) => ModuleDecl; readonly key: (axes: AxisValues<A>) => string;}Instance properties
axesread onlyAThe axes, each as the list of values the host can select.
buildread only(axes: AxisValues<A>) => ModuleDeclBuild the module for one point in the space. Ordinary TypeScript branching: read the axis values and construct only what this point needs, so the losing arm is never built.
keyread only(axes: AxisValues<A>) => stringThe program’s identity. Must mention every axis
buildreads: two points that derive the same key would share one cache id while naming different programs, andvariantFamilythrows when that happens. Derive it fromaxes; a key written by hand is how an axis gets left out.
See also
Source
src/core/variant-family.ts, line 49, at commit 26de7be8