frontend/.pnpm-store/v3/files/f7/486127d50741b553b4d0f8b4d4bff90cf7c29a7705bfb8220b809783dd6c8b5c295e162ed0f5a2be035089abb6ea1b1ef63f09955114eb23750f4243b47a03

23 lines
561 B
Plaintext

import type {IsEqual} from './is-equal';
/**
Returns a boolean for whether the given array includes the given item.
This can be useful if another type wants to make a decision based on whether the array includes that item.
@example
```
import type {Includes} from 'type-fest';
type hasRed<array extends any[]> = Includes<array, 'red'>;
```
@category Array
*/
export type Includes<Value extends readonly any[], Item> =
Value extends readonly [Value[0], ...infer rest]
? IsEqual<Value[0], Item> extends true
? true
: Includes<rest, Item>
: false;