mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-03 16:50:15 +00:00
Add more tests for the ValidationError
This commit is contained in:
2
types/yup/index.d.ts
vendored
2
types/yup/index.d.ts
vendored
@@ -216,7 +216,7 @@ export interface ValidationError {
|
||||
/**
|
||||
* array of error messages
|
||||
*/
|
||||
errors: string | string[];
|
||||
errors: string[];
|
||||
|
||||
/**
|
||||
* In the case of aggregate errors, inner is an array of ValidationErrors throw earlier in the validation chain.
|
||||
|
||||
@@ -52,6 +52,24 @@ const renderables = yup.array().of(renderable);
|
||||
let error: ValidationError = yup.ValidationError('error', 'value', 'path');
|
||||
error = yup.ValidationError(['error', 'error2'], true, 'path');
|
||||
error = yup.ValidationError(['error', 'error2'], 5, 'path');
|
||||
error = yup.ValidationError(['error', 'error2'], {name: 'value'}, 'path');
|
||||
error = yup.ValidationError(['error', 'error2'], {name: 'value'}, 'path', 'type');
|
||||
error = {
|
||||
name: 'ValidationError',
|
||||
message: 'error',
|
||||
path: 'path',
|
||||
errors: ['error'],
|
||||
inner: [yup.ValidationError('error', true, 'path')],
|
||||
type: 'date',
|
||||
value: {start: '2017-11-10'}
|
||||
};
|
||||
validationError.value = 'value';
|
||||
validationError.value = true;
|
||||
validationError.value = 5;
|
||||
validationError.value = {name: 'value'};
|
||||
validationError.type = {};
|
||||
validationError.type = [];
|
||||
validationError.errors = ['error'];
|
||||
|
||||
// mixed
|
||||
let mixed: MixedSchema = yup.mixed();
|
||||
|
||||
Reference in New Issue
Block a user