Skip to content

Commit

Permalink
Release 0.0.1-next.3
Browse files Browse the repository at this point in the history
  • Loading branch information
accuser committed Nov 9, 2024
1 parent 4b0f051 commit fabaad3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
28 changes: 20 additions & 8 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ declare const schemaField: {
readonly validate: (value: unknown, field: unknown, path?: string[]) => ValidationError[];
};

declare const VALIDATION_ERROR_NAME = "ValidationError";
interface ValidationError extends Error {
readonly name: typeof VALIDATION_ERROR_NAME;
readonly path: readonly string[];
readonly __validationError: unique symbol;
}

type ValidationErrorTransformer = (error: ValidationError) => ValidationError;

declare const validationError: {
readonly create: (params: Omit<ValidationError, "name" | "__validationError">) => ValidationError;
readonly fromError: (error: Error, path?: readonly string[]) => ValidationError;
readonly fromString: (error: string, path?: readonly string[]) => ValidationError;
readonly is: (error: unknown) => error is ValidationError;
readonly pipe: (...transformers: ValidationErrorTransformer[]) => ValidationErrorTransformer;
readonly withContext: (context: string) => ValidationErrorTransformer;
readonly withPath: (path: readonly string[]) => ValidationErrorTransformer;
};

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

declare const VALIDATION_ERROR_NAME = "ValidationError";
interface ValidationError extends Error {
readonly name: typeof VALIDATION_ERROR_NAME;
readonly path: readonly string[];
readonly __validationError: unique symbol;
}

export { type SchemaField, type ValidationError, schemaField as default };
export { type SchemaField, type ValidationError, schemaField as default, validationError };
2 changes: 1 addition & 1 deletion 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.2",
"version": "0.0.1-next.3",
"description": "Simple schema.",
"private": false,
"type": "module",
Expand Down

0 comments on commit fabaad3

Please sign in to comment.