我是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))