1
我是Flow的新手,並且正確分配給DOM元素類型時遇到了一些問題。與document.querySelector一起使用流程
看看Flow回購中的DOM declarations,感覺就像我錯過了一些東西。
// Works
const otherMeta:?HTMLMetaElement = document.querySelector("meta");
//Doesn't work
const metaTag:?HTMLMetaElement = document.querySelector("meta[name='something']");
第二個例子導致以下錯誤:
const metaTag:?HTMLMetaElement = document.querySelector("meta[name='something']");
^HTMLElement. This type is incompatible with
const metaTag:?HTMLMetaElement = document.querySelector("meta[name='something']");
^HTMLMetaElement
已經在嘗試流REPL工具來看看the example。