import type Optional from "./Optional.js"; import Runtype, { type Parsed, type Static } from "./Runtype.js"; type RecordStatic = Runtype.Core, V extends Runtype.Core = Runtype.Core> = V extends Optional ? { [_ in Static]?: Static; } : { [_ in Static]: Static; }; type RecordParsed = Runtype.Core, V extends Runtype.Core = Runtype.Core> = V extends Optional ? { [_ in Parsed]?: Parsed; } : { [_ in Parsed]: Parsed; }; /** * Validates that a value is an object, and properties fulfill the given key and value runtypes. * * Possible failures: * * - `TYPE_INCORRECT` for `null`, `undefined`, non-objects, non-plain-object non-arrays, and non-plain-object arrays if the key runtype was `String` * - `CONTENT_INCORRECT` with `details` reporting the failed properties * * For each property, contextual failures can be seen in addition to failures of the property runtype: * * - `PROPERTY_MISSING` for missing required properties * - `KEY_INCORRECT` with `detail` reporting the failure of the key runtype */ interface Record = Runtype.Core, V extends Runtype.Core = Runtype.Core> extends Runtype, RecordParsed> { tag: "record"; key: K; value: V; } declare const Record: , V extends Runtype.Core>(key: K, value: V) => Record; export default Record;