UNPKG

@sinclair/typebox

Version:

Json Schema Type Builder with Static Type Resolution for TypeScript

43 lines (42 loc) 2.12 kB
import type { Static } from '../../type/static/index'; import { TypeBoxError } from '../../type/error/index'; export type Insert = Static<typeof Insert>; export declare const Insert: import("../../type/object/object").TObject<{ type: import("../../type/literal/literal").TLiteral<"insert">; path: import("../../type/string/string").TString; value: import("../../type/unknown/unknown").TUnknown; }>; export type Update = Static<typeof Update>; export declare const Update: import("../../type/object/object").TObject<{ type: import("../../type/literal/literal").TLiteral<"update">; path: import("../../type/string/string").TString; value: import("../../type/unknown/unknown").TUnknown; }>; export type Delete = Static<typeof Delete>; export declare const Delete: import("../../type/object/object").TObject<{ type: import("../../type/literal/literal").TLiteral<"delete">; path: import("../../type/string/string").TString; }>; export type Edit = Static<typeof Edit>; export declare const Edit: import("../../type/union/union-type").TUnion<[import("../../type/object/object").TObject<{ type: import("../../type/literal/literal").TLiteral<"insert">; path: import("../../type/string/string").TString; value: import("../../type/unknown/unknown").TUnknown; }>, import("../../type/object/object").TObject<{ type: import("../../type/literal/literal").TLiteral<"update">; path: import("../../type/string/string").TString; value: import("../../type/unknown/unknown").TUnknown; }>, import("../../type/object/object").TObject<{ type: import("../../type/literal/literal").TLiteral<"delete">; path: import("../../type/string/string").TString; }>]>; export declare class ValueDeltaError extends TypeBoxError { readonly value: unknown; constructor(value: unknown, message: string); } export declare class ValueDeltaSymbolError extends ValueDeltaError { readonly value: unknown; constructor(value: unknown); } export declare function Diff(current: unknown, next: unknown): Edit[]; export declare function Patch<T = any>(current: unknown, edits: Edit[]): T;