VariantFamilySpec
이 페이지에서

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읽기 전용 A

The axes, each as the list of values the host can select.

build읽기 전용 (axes: AxisValues<A>) => ModuleDecl

Build 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>) => string

The program’s identity. Must mention every axis build reads: two points that derive the same key would share one cache id while naming different programs, and variantFamily throws when that happens. Derive it from axes; a key written by hand is how an axis gets left out.

함께 보기

소스

src/core/variant-family.ts, 49행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고