diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index dfc4e47192..97c9618428 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -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. diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index a22d96f594..0b5c6b643c 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -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();