Javascript HTMLDocument的Proptype是什么
我有一个道具可以接受Javascript HTMLDocument的Proptype是什么,javascript,reactjs,Javascript,Reactjs,我有一个道具可以接受window.document <MyComponent container={document} /> 啊!!下面使用instanceOf container: PropTypes.instanceOf(HTMLDocument).isRequired 更新 “HTMLDocument”在IE10中不起作用 如果您需要支持IE10,可以使用 PropTypes.instanceOf(Document) 如上所述,抽象接口扩展了接口。它可能是元素吗?(充其量
window.document
<MyComponent container={document} />
啊!!下面使用
instanceOf
container: PropTypes.instanceOf(HTMLDocument).isRequired
更新
“HTMLDocument”在IE10中不起作用
如果您需要支持IE10,可以使用
PropTypes.instanceOf(Document)
如上所述,抽象接口扩展了接口。它可能是元素吗?(充其量只是有教育意义的猜测)但也许?promisified:试过了。无骰子:(您是否尝试了
PropTypes.node
?“警告:失败的道具类型:类型HTMLDocument
的无效道具,Chrome中应为HTMLDocument
”的实例…漂亮且有用的错误消息!
PropTypes.instanceOf(Document)