Skip to content

Commit

Permalink
add missing Headers interface augmentation from lib.dom.iterable.d.ts
Browse files Browse the repository at this point in the history
declaration files were generated and tested with the following command:

npm i --no-save typescript@4.2.3 \
&& cat <<EOF > .ts-graftrc.yaml \
&& npx ts-graft@1.0.1 \
&& rm .ts-graftrc.yaml \
&& npx tsc --lib ES2016 --target ES2016 --noEmit index.d.ts \
&& npm un typescript
grafts:
- source: typescript/lib/lib.dom.d.ts
  output: lib.fetch.d.ts
  include:
    - BodyInit
    - HeadersInit
    - RequestInfo
    - RequestInit
    - Response
    - ResponseInit
- source: typescript/lib/lib.dom.iterable.d.ts
  output: lib.fetch.dom.iterable.d.ts
  include:
    - Headers
EOF
  • Loading branch information
jstewmon committed Mar 19, 2021
1 parent 633fa8c commit 215e1ca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.d.ts
@@ -1,13 +1,15 @@
import {
import type {
BodyInit,
Headers,
Headers as BaseHeaders,
HeadersInit,
Request,
RequestInfo,
RequestInit,
Response,
ResponseInit,
} from "./lib.fetch"
import type { Headers as IterHeaders } from "./lib.fetch.iterable";
type Headers = BaseHeaders & IterHeaders;

export const fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;

Expand Down
16 changes: 16 additions & 0 deletions lib.fetch.iterable.d.ts
@@ -0,0 +1,16 @@
// Generated by resolving typescript/lib/lib.dom.iterable.d.ts from typescript@4.2.3
export interface Headers {
[Symbol.iterator](): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all key/value pairs contained in this object.
*/
entries(): IterableIterator<[string, string]>;
/**
* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
*/
keys(): IterableIterator<string>;
/**
* Returns an iterator allowing to go through all values of the key/value pairs contained in this object.
*/
values(): IterableIterator<string>;
}
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -86,7 +86,8 @@
"dist",
"polyfill",
"index.d.ts",
"lib.fetch.d.ts"
"lib.fetch.d.ts",
"lib.fetch.iterable.d.ts"
],
"keywords": [
"fetch",
Expand Down

0 comments on commit 215e1ca

Please sign in to comment.