tuf*_*uff 3 javascript flowtype
Flow似乎没有认识到querySelector可能会返回以下子类型HTMLElement:
var myIframe = document.querySelector('iframe');
function foo(iframe: HTMLIFrameElement): void {
// I want to do iframe stuff!
}
foo(myIframe);
Run Code Online (Sandbox Code Playgroud)
产生
10: foo(myIframe);
^ HTMLElement. This type is incompatible with
6: function foo(iframe: HTMLIFrameElement): void {
^ HTMLIFrameElement
Run Code Online (Sandbox Code Playgroud)
除了键入它之外,有什么方法可以myIframe让我使用它的HTMLElement属性和HTMLIFrameElement属性Object吗?