The headers#get method returns a header value or null. So this method won't return undefined. but it's typed with js.UndefOr. https://developer.mozilla.org/en-US/docs/Web/API/Headers/get https://github.com/scala-js/scala-js-dom/blob/5a502ad998eb3f9a6a38a4494a30cc9a55f0c916/src/main/scala/org/scalajs/dom/experimental/Fetch.scala#L312