Rocky_Mountain_Vending/.pnpm-store/v10/files/21/b069fc73ec383533e008e34341b09ce34be47f2a8fbce75f7d8a0ecf784320b92c09c5e69412de485f9f357e404838714dc4ff1dbc8efcd5cfbeeae715c76b
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

51 lines
1.3 KiB
Text

/**
Create a union of types that share a common discriminant property.
Use-case: A shorter way to declare tagged unions with multiple members.
@example
```
import type {TaggedUnion} from 'type-fest';
type Tagged<Fields extends Record<string, unknown> = TaggedUnion<'type', Fields>
// The TaggedUnion utility reduces the amount of boilerplate needed to create a tagged union with multiple members, making the code more concise.
type EventMessage = Tagged<{
OpenExternalUrl: {
url: string;
id: number;
language: string;
};
ToggleBackButtonVisibility: {
visible: boolean;
};
PurchaseButtonPressed: {
price: number;
time: Date;
};
NavigationStateChanged: {
navigation?: string;
};
}>;
// Here is the same type created without this utility.
type EventMessage =
| {
type: 'OpenExternalUrl';
url: string;
id: number;
language: string;
}
| {type: 'ToggleBackButtonVisibility'; visible: boolean}
| {type: 'PurchaseButtonPressed'; price: number; time: Date}
| {type: 'NavigationStateChanged'; navigation?: string};
```
@category Utilities
*/
export type TaggedUnion<
TagKey extends string,
UnionMembers extends Record<string, Record<string, unknown>>,
> = {
[Name in keyof UnionMembers]: {[Key in TagKey]: Name} & UnionMembers[Name];
}[keyof UnionMembers];