import type Runtype from "./Runtype.js"; import type HasSymbolIterator from "./utils-internal/HasSymbolIterator.js"; /** * A pseudo-runtype that is only usable in the context of `Tuple` arguments. This works as the runtime counterpart of variadic tuple types. * * ```typescript * const T = Tuple(Literal(0), Spread(Tuple(Literal(1), Literal(2))), Literal(3)) * type T = Static // [0, 1, 2, 3] * * const U = Tuple(Literal(0), Spread(Array(Literal(1))), Literal(2)) * type U = Static // [0, ...1[], 2] * ``` * * `Spread` only accepts a `Tuple`, an `Array`, and trivial runtypes around them e.g. `Tuple(...).withBrand(...)` and `Union(Array(...))`. Using the spread operator `...` against those runtypes yields a `Spread` just once, so you can write `...Tuple(...)` instead of `Spread(Tuple(...))`. * * ```typescript * const T = Tuple(Literal(0), ...Tuple(Literal(1), Literal(2)), Literal(3)) * type T = Static // [0, 1, 2, 3] * const U = Tuple(Literal(0), ...Array(Literal(1)), Literal(2)) * type U = Static // [0, ...1[], 2] * ``` */ interface Spread { tag: "spread"; content: R; } declare const Spread: { (content: HasSymbolIterator extends true ? R : never): Spread; /** @internal */ asSpreadable: >(base: B) => B; }; export default Spread;