这段代码:
import { Modal } from "office-ui-fabric-react/lib/Modal";
import * as React from "react";
export interface ISignInFormProps {
showModal: boolean;
}
const SignInForm = () => {
return <Modal>Hello</Modal>;
};
export default SignInForm;
产生以下错误:
(9,11): Type '{ children: string; }' has no properties in common with type 'IntrinsicAttributes & IModalProps'.
此 CodePen 不显示任何错误 - https://codepen.io/camden-kid/pen/aMmzKq?editors=0010
问题的原因是什么以及如何解决?
最佳答案
我们已解决此问题。 TypeScript 3.x 暴露了我们样式实用程序的返回值的键入错误,该返回值没有使用 React 的 StatelessComponent 类型,因此没有 children
属性。 PR是here并且应该会在我们的下一个夜间版本中提供。
关于reactjs - 类型 '{ children: string; }' 与类型 'IntrinsicAttributes & IModalProps' 没有共同属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54987235/