Rocky_Mountain_Vending/.pnpm-store/v10/files/d6/7e5bf86228241267fe1a865f5e66e282b0eb5944dfdc141670b59cccf133eecc3a48b7777a4efb1b6c30d3c9798d96e909625bf7254abec841fde1a983cca9
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

56 lines
1.3 KiB
Text

import type {IsNever} from './is-never';
import type {UnionToIntersection} from './union-to-intersection';
/**
Returns the last element of a union type.
@example
```
type Last = LastOfUnion<1 | 2 | 3>;
//=> 3
```
*/
type LastOfUnion<T> =
UnionToIntersection<T extends any ? () => T : never> extends () => (infer R)
? R
: never;
/**
Convert a union type into an unordered tuple type of its elements.
"Unordered" means the elements of the tuple are not guaranteed to be in the same order as in the union type. The arrangement can appear random and may change at any time.
This can be useful when you have objects with a finite set of keys and want a type defining only the allowed keys, but do not want to repeat yourself.
@example
```
import type {UnionToTuple} from 'type-fest';
type Numbers = 1 | 2 | 3;
type NumbersTuple = UnionToTuple<Numbers>;
//=> [1, 2, 3]
```
@example
```
import type {UnionToTuple} from 'type-fest';
const pets = {
dog: '🐶',
cat: '🐱',
snake: '🐍',
};
type Pet = keyof typeof pets;
//=> 'dog' | 'cat' | 'snake'
const petList = Object.keys(pets) as UnionToTuple<Pet>;
//=> ['dog', 'cat', 'snake']
```
@category Array
*/
export type UnionToTuple<T, L = LastOfUnion<T>> =
IsNever<T> extends false
? [...UnionToTuple<Exclude<T, L>>, L]
: [];