object-shape-tester
Version:
Test object properties and value types.
20 lines (19 loc) • 703 B
TypeScript
import { type ArrayElement, type AtLeastTuple } from '@augment-vir/common';
import { type ShapeInitSchema } from '../shape/shape.js';
/**
* Creates a shape that requires an of the given possible values.
*
* @category Shape
* @example
*
* ```ts
* import {unionShape, checkValidShape} from 'object-shape-tester';
*
* const myShape = unionShape('', -1);
*
* checkValidShape('a', myShape); // `true`
* checkValidShape(10, myShape); // `true`
* checkValidShape({}, myShape); // `false`
* ```
*/
export declare function unionShape<T extends Readonly<AtLeastTuple<any, 1>>>(...inits: T): import("../shape/shape.js").Shape<import("@sinclair/typebox").TUnion<ShapeInitSchema<ArrayElement<T>>[]>>;