ts-valid8
Version:
A next-generation TypeScript validation library with advanced features
63 lines • 1.89 kB
TypeScript
/**
* Valid8 - Next-generation TypeScript validation library
* A powerful, type-safe, and feature-rich validation library with support for
* complex validations and cross-field validation
*/
import { StringSchema } from './validators/string';
import { ObjectSchema } from './validators/object';
import { BooleanSchema } from './validators/boolean';
import { Schema } from './core/types';
import { applyPlugin } from './utils/builder';
export * from './core/types';
export * from './plugins';
export { applyPlugin };
/**
* Valid8 - The main library API
*/
export declare const Valid8: {
/**
* Create a string schema
*/
string(): StringSchema;
/**
* Create an object schema
*/
object<T extends Record<string, Schema<any>>>(shape: T): ObjectSchema<T>;
/**
* Create a boolean schema
*/
boolean(): BooleanSchema;
/**
* Create a validation pipeline with multiple schemas
* Tries each schema in order until one succeeds
*/
oneOf<T_1 extends Schema<any>[]>(schemas: [...T_1]): Schema<any>;
/**
* Create a validation context with custom data
* Useful for advanced validation scenarios
*/
context(data: Record<string, any>): {
withSchema<T_2>(schema: Schema<T_2>): {
validate(value: unknown): import("./core/types").ValidationResult<T_2>;
};
};
/**
* Plugin system for extending the library
*/
plugins: {
/**
* Register a plugin with the library
*/
use: (plugin: import("./plugins").PluginDefinition) => void;
/**
* Create a custom plugin
*/
create: (name: string, version: string, install: Function) => {
name: string;
version: string;
install: Function;
};
};
};
export default Valid8;
//# sourceMappingURL=index.d.ts.map