export type TupleType = { values: Readonly, isValue: (value: unknown) => value is T[number], } /** * Creates a tuple with the provided values. * * @template T - The type of the elements in the tuple. * @param {T} values - The values to be included in the tuple. * @returns {TupleType} An object representing the tuple, with a `values` property containing the tuple values and an `isValue` method to check if a value is part of the tuple. */ export function createTuple(values: T): TupleType { const tuple = new Set(values) function isValue(value: unknown): value is T[number] { return tuple.has(value) } return { values, isValue, } }