Skip to content

validate

@tsed/cli-core

Usage ​

typescript
import { validate } from "@tsed/cli-core";

See /packages/cli-core/src/utils/validate.ts.

Overview ​

ts
function validate<Value>(value: unknown, schema: JsonSchema<Value>): {
    isValid: boolean;
    errors: {
        path: string;
        message: string | undefined;
        expected: any;
    }[];
    value?: undefined;
} | {
    isValid: boolean;
    value: Value;
    errors?: undefined;
};

isValid ​

ts
isValid: boolean;

errors ​

ts
errors: {
     path: string;
     message: string | undefined;
     expected: any;
 }[];

value ​

ts
value?: undefined;

​

ts
} | {

isValid ​

ts
isValid: boolean;

value ​

ts
value: Value;

errors ​

ts
errors?: undefined;

Released under the MIT License.