---
title: "VariantFamilySpec: interface in Variants, TypeShade API"
description: "VariantFamilySpec, an interface in Variants. What variantFamily is given."
url: https://typeshade.dev/api/variantfamilyspec/
language: en
---

# `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 af54ddad5.

## Syntax

```ts
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

**`axes` read only `A`**

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

**`build` read only `(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` read only `(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`](https://typeshade.dev/api/variantfamily/) throws when that happens. Derive it from `axes`; a key written by hand is how an axis gets left out.

## See also

- [`variantFamily`](https://typeshade.dev/api/variantfamily/)

## Source

[`src/core/variant-family.ts`, line 49](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/variant-family.ts#L49), at commit af54ddad5
