Define a shape part that's an object with a specific set of keys and values.
import {exact, defineShape, indexedKeys} from 'object-shape-tester';const myShape = defineShape({ a: indexedKeys({ keys: or(exact('hi'), exact('bye')), values: { helloThere: 0, }, required: false, }),});// `myShape.runtimeType` is `{a: Partial<Record<'hi' | 'bye', {helloThere: number}>>}` Copy
import {exact, defineShape, indexedKeys} from 'object-shape-tester';const myShape = defineShape({ a: indexedKeys({ keys: or(exact('hi'), exact('bye')), values: { helloThere: 0, }, required: false, }),});// `myShape.runtimeType` is `{a: Partial<Record<'hi' | 'bye', {helloThere: number}>>}`
Define a shape part that's an object with a specific set of keys and values.