VariantFamilySpec
인터페이스, 배리언트 분류
What variantFamily is given.
import type { VariantFamilySpec } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface VariantFamilySpec<A extends Record<string, readonly unknown[]>> { readonly axes: A; readonly build: (axes: AxisValues<A>) => ModuleDecl; readonly key: (axes: AxisValues<A>) => string;}인스턴스 속성
axes읽기 전용AThe axes, each as the list of values the host can select.
build읽기 전용(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.
key읽기 전용(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.
함께 보기
소스
src/core/variant-family.ts, 49행, 커밋 c66579bf 기준