Skip to content

Commit

Permalink
Release 0.0.1-next.5
Browse files Browse the repository at this point in the history
  • Loading branch information
accuser committed Nov 10, 2024
1 parent 36797fd commit edf8949
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 29 deletions.
8 changes: 6 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare const schemaField: {
readonly valid: (value: unknown, field: unknown) => boolean;
readonly validate: (value: unknown, field: unknown, path?: string[]) => ValidationError[];
readonly validate: Validator;
};

declare const VALIDATION_ERROR_NAME = "ValidationError";
Expand All @@ -22,6 +22,10 @@ declare const validationError: {
readonly withPath: (path: readonly string[]) => ValidationErrorTransformer;
};

type Validator = (value: unknown, field: unknown, path?: string[]) => ValidationError[];

declare const register: (type: string, validator: Validator) => void;

interface ArrayField {
readonly type: 'Array';
readonly items: SchemaField;
Expand Down Expand Up @@ -78,4 +82,4 @@ interface SchemaFieldMap {
}
type SchemaField = SchemaFieldMap[keyof SchemaFieldMap];

export { type SchemaField, type ValidationError, schemaField as default, validationError };
export { type SchemaField, type ValidationError, type Validator, schemaField as default, register, validationError };
74 changes: 49 additions & 25 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typematter/schema",
"version": "0.0.1-next.4",
"version": "0.0.1-next.5",
"description": "Simple schema.",
"private": false,
"type": "module",
Expand Down

0 comments on commit edf8949

Please sign in to comment.