persona-community-5/.pnpm-store/v3/files/8e/e0ffa1649daabd1dac58fc8888a04f7ec08af6928f10df21b9cef805db052443a8d566488c967308ac0e4f658a30d3cac49f36785821824f5378619842a929
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

24 lines
725 B
Plaintext

/**
Provides valid indices for a constant array or tuple.
Use-case: This type is useful when working with constant arrays or tuples and you want to enforce type-safety for accessing elements by their indices.
@example
```
import type {ArrayIndices, ArrayValues} from 'type-fest';
const weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] as const;
type Weekday = ArrayIndices<typeof weekdays>;
type WeekdayName = ArrayValues<typeof weekdays>;
const getWeekdayName = (day: Weekday): WeekdayName => weekdays[day];
```
@see {@link ArrayValues}
@category Array
*/
export type ArrayIndices<Element extends readonly unknown[]> =
Exclude<Partial<Element>['length'], Element['length']>;