typescript@types/yup验证返回未定义?

typescript@types/yup验证返回未定义?,typescript,types,yup,Typescript,Types,Yup,我已经在我的typescript项目中使用yup有一段时间了。类型定义需要@types/yup。我使用了它的v0.26.4,一切都很好。但今天我将依赖项更新为v0.29.3。这里有点不对劲: //The object schema constructor from <T extends object>(fields?: ObjectSchemaDefinition<T>): ObjectSchema<T>; //changed to <T exte

我已经在我的typescript项目中使用yup有一段时间了。类型定义需要@types/yup。我使用了它的
v0.26.4
,一切都很好。但今天我将依赖项更新为
v0.29.3
。这里有点不对劲:

//The object schema constructor from 
<T extends object>(fields?: ObjectSchemaDefinition<T>): ObjectSchema<T>;

//changed to 
<T extends object>(fields?: ObjectSchemaDefinition<T>): ObjectSchema<T | undefined>;

//then for my validation code:
const validated = await CreateNewsValidator.validate(req.body); // T | undefined
//when i use validated, the error Type 'undefined' is not assignable to type X comes
//来自的对象架构构造函数
(字段?:ObjectSchemaDefinition):ObjectSchema;
//改为
(字段?:ObjectSchemaDefinition):ObjectSchema;
//然后,对于我的验证代码:
const validated=等待CreateNewsValidator.validate(req.body);//T |未定义
//当我使用validated时,错误类型“undefined”不能分配给类型X
我的问题是validate方法何时返回undefined?解决方法是什么,我应该切换回0.26.4吗?他们为什么要做出这样的改变