cross-fetch icon indicating copy to clipboard operation
cross-fetch copied to clipboard

Fix iteration methods are missing in Headers type

Open ciffelia opened this issue 4 years ago • 0 comments

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()) {
  // ...
}

ciffelia avatar Sep 19 '21 06:09 ciffelia