UNPKG

object-shape-tester

Version:
34 lines (33 loc) 737 B
import { type ShapeInitSchema } from '../shape/shape.js'; /** * Converts an object shape to a partial shape. * * @category Shape * @example * * ```ts * import {partialShape, checkValidShape} from 'object-shape-tester'; * * const myShape = partialShape({ * id: '', * name: '', * age: -1, * }); * * checkValidShape({}, myShape); // `true` * checkValidShape( * { * id: '123', * name: 'hello', * }, * myShape, * ); // `true` * checkValidShape( * { * invalid: 'prop', * }, * myShape, * ); // `false` * ``` */ export declare function partialShape<T>(init: T): import("../shape/shape.js").Shape<import("@sinclair/typebox").TPartial<ShapeInitSchema<T>>>;