lquixada / cross-fetch

Universal WHATWG Fetch API for Node, Browsers and React Native.
MIT License
1.67k stars 104 forks source link

Fix iteration methods are missing in Headers type #116

Closed ciffelia closed 1 year ago

ciffelia commented 2 years ago

This pull request adds reference to dom.iterable lib in index.d.ts, because some methods to iterate over Headers are declared in lib.dom.iterable.d.ts instead of lib.dom.d.ts.

https://github.com/microsoft/TypeScript/blob/v4.4.3/lib/lib.dom.d.ts#L8910-L8918 https://github.com/microsoft/TypeScript/blob/v4.4.3/lib/lib.dom.iterable.d.ts#L115-L129

With this change we can call Headers.entries(), Headers.keys(), and Headers.values() method in TypeScript.

import { Headers } from 'cross-fetch'

const headers = new Headers()
for (const [key, value] of headers.entries()) {
  // ...
}
stazz commented 1 year ago

Any reason why this seems to be on hold for a while? :)