Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
switch (typeof value) {
case 'number':
return yup.number();
case 'string':
return yup.string();
default:
return yup.mixed();
}
});
const renderables = yup.array().of(renderable);
// ValidationError static methods
// $ExpectType boolean
ValidationError.isError(new ValidationError('error', 'value', 'path'));
// $ExpectType string | ((params?: any) => string)
ValidationError.formatError('error', { path: 'path' });
ValidationError.formatError('error');
ValidationError.formatError(() => 'error');
ValidationError.formatError(() => 'error', { path: 'path' });
// ValidationError
let error: ValidationError = new yup.ValidationError('error', 'value', 'path');
error = new yup.ValidationError(['error', 'error2'], true, 'path');
error = new yup.ValidationError(['error', 'error2'], 5, 'path');
error = new yup.ValidationError(['error', 'error2'], { name: 'value' }, 'path');
error = new yup.ValidationError(['error', 'error2'], { name: 'value' }, 'path', 'type');
error = {
name: 'ValidationError',
message: 'error',
path: 'path',
errors: ['error'],
inner: [new yup.ValidationError('error', true, 'path')],
case 'string':
return yup.string();
default:
return yup.mixed();
}
});
const renderables = yup.array().of(renderable);
// ValidationError static methods
// $ExpectType boolean
ValidationError.isError(new ValidationError('error', 'value', 'path'));
// $ExpectType string | ((params?: any) => string)
ValidationError.formatError('error', { path: 'path' });
ValidationError.formatError('error');
ValidationError.formatError(() => 'error');
ValidationError.formatError(() => 'error', { path: 'path' });
// ValidationError
let error: ValidationError = new yup.ValidationError('error', 'value', 'path');
error = new yup.ValidationError(['error', 'error2'], true, 'path');
error = new yup.ValidationError(['error', 'error2'], 5, 'path');
error = new yup.ValidationError(['error', 'error2'], { name: 'value' }, 'path');
error = new yup.ValidationError(['error', 'error2'], { name: 'value' }, 'path', 'type');
error = {
name: 'ValidationError',
message: 'error',
path: 'path',
errors: ['error'],
inner: [new yup.ValidationError('error', true, 'path')],
type: 'date',
value: { start: '2017-11-10' },
};