Sha256: 380b4fe5dac74984ac6a58a116f7726bede1bdca7cec5362034c0b12971ac9c1
Contents?: true
Size: 725 Bytes
Versions: 28
Compression:
Stored size: 725 Bytes
Contents
/** 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']>;
Version data entries
28 entries across 28 versions & 2 rubygems