domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
20 lines (19 loc) • 870 B
TypeScript
import { type SchemaOptions } from './validate';
/**
* .what = reports whether a schema accepts the props, and (when it accepts) whether it is strict (closed)
* .why = structural disambiguation needs both signals; callers get them without any knowledge of
* the specific schema library (zod/joi/yup) or the strict-probe mechanism — that stays here
* .note = strict is only meaningful when the schema accepts the props (there is no accepted object
* to probe otherwise); the union return makes that a compile-time guarantee — `strict` is only
* present on the `accepts: true` branch, so callers cannot read it when `accepts: false`
*/
export declare const getSchemaFit: ({ schema, props, schemaName, }: {
schema: SchemaOptions<any>;
props: any;
schemaName: string;
}) => {
accepts: false;
} | {
accepts: true;
strict: boolean;
};