# VariantFactory Source: https://partfactory.dev/factories/variant-factory/ Index of every page: https://partfactory.dev/llms.txt Creates complete items from another factory with preset overrides. Use this factory to describe a named variation of a base factory without duplicating all the base defaults. The preset overrides are applied first, then any overrides passed to `make` can further customize the final item. Any dependencies the base factory declares are forwarded to it, so a variant of a factory with dependencies is made in the same way as any other variant. ## Usage ```typescript interface User { name: string; role: "user" | "admin"; active: boolean; } const userFactory = new StaticFactory({ name: "Test User", role: "user", active: true, }); const adminFactory = new VariantFactory(userFactory, { role: "admin", }); const admin = adminFactory.make(); // { name: "Test User", role: "admin", active: true } const inactiveAdmin = adminFactory.make({ active: false }); // { name: "Test User", role: "admin", active: false } ``` ## Source Source file: [`src/variant/variant-factory.ts`](https://github.com/KensioSoftware/part-factory/blob/main/src/variant/variant-factory.ts)