object-shape-tester
Version:
Test object properties and value types.
19 lines (18 loc) • 633 B
TypeScript
/**
* Creates a shape that requires a string and gives it a specific type. This does _not_ apply any
* extra type safety beyond string checking.
*
* @category Shape
* @example
*
* ```ts
* import {typedString, checkValidShape} from 'object-shape-tester';
*
* const myShape = typedString<`${string}-${string}`>();
*
* checkValidShape('1-2', myShape); // `true`
* checkValidShape('1', myShape); // `true`
* checkValidShape(1, myShape); // `false`
* ```
*/
export declare function typedStringShape<const T extends string>(defaultValue?: string): import("../shape/shape.js").Shape<import("@sinclair/typebox").TUnsafe<T>>;