object-shape-tester
Version:
Test object properties and value types.
11 lines (10 loc) • 307 B
JavaScript
import { Symbol } from '@sinclair/typebox';
import { unionShape } from './union.shape.js';
/**
* Creates a shape that only allows primitive values.
*
* @category Shape
*/
export function primitiveShape(defaultValue) {
return unionShape(defaultValue, '', -1, 0n, false, Symbol(), null, undefined);
}