react-i18next withNamespaces 如何在 antd 表单中使用

How use react-i18next withNamespaces in antd forms

我是 i18next 打字稿的新手,我想使用 withNamespaces 翻译一个 antd 表单

export default withNamespaces()(Form.create()(MyComponent));

这给了我以下错误:

Argument of type 'ComponentClass<RcBaseFormProps & Pick<any, string | number | symbol>, any>' is not assignable to parameter of type 'ComponentType<WithNamespaces>'. Type 'ComponentClass<RcBaseFormProps & Pick<any, string | number | symbol>, any>' is not assignable to type 'ComponentClass<WithNamespaces, any>'. Type 'RcBaseFormProps & Pick<any, string | number | symbol>' is missing the following properties from type 'WithNamespaces': tReady, i18n, t

正确的做法是什么?谢谢

如果有人有同样的问题可以使用recompose包。

https://github.com/acdlite/recompose

然后做这样的事情:

import { compose} from 'recompose'

{...}

export default compose(withNamespaces())(Form.create()(MyComponent))