import type { As, RangeNumber } from '@chzky/core'; import type { TupleArray, TupleItem } from './interface.js'; import { Immut } from '../../../mod.js'; /** ## `Tuple` :`Immut`的特化,源于[proposal-record-tuple](https://github.com/tc39/proposal-record-tuple)提案 ### Feature : Tuple 1. value值只支持以下几种类型 : `string` | `number` | `boolean` | `Record` | `Tuple` | `Refer` 2. 当尝试使用其他类型作为value值时,会抛出`TypeError` 3. 当尝试使用空数组时,会抛出`TypeError` @example Usage ```ts const tup = Tuple([1, false, 'xxm']) assert_throw(() => { tup.safe()[1] = 12 }, ReadOnlyError) assert(tup.eq(Tuple.of(1, false, 'xxm'))) ``` @category TypeClass */ export interface Tuple extends Immut>, As, 'array'> { /** ### `at` : 获取index值 */ at(index: RangeNumber): T; } declare function internal_tuple(tuple_array: TupleArray): Tuple; export declare const Tuple: typeof internal_tuple & { of: (...items: TupleArray) => Tuple; }; declare function is_tuple(val: unknown): val is Tuple; export { is_tuple, type TupleArray }; //# sourceMappingURL=tuple.d.ts.map