[node-fetch] Fix interable members (were wrongly typed to Iterator) (#44147)

* [node-fetch] Switch to strict mode, drop unnecessary ES5 lib

* [node-fetch] Fix interable members (were wrongly typed to `Iterator`)
This commit is contained in:
ulrichb 2020-04-23 21:27:33 +02:00 committed by GitHub
parent cd367bc61a
commit 839738b973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View File

@ -117,10 +117,10 @@ export class Headers implements Iterable<[string, string]> {
raw(): { [k: string]: string[] };
set(name: string, value: string): void;
// Iterator methods
entries(): Iterator<[string, string]>;
keys(): Iterator<string>;
values(): Iterator<[string]>;
// Iterable methods
entries(): IterableIterator<[string, string]>;
keys(): IterableIterator<string>;
values(): IterableIterator<[string]>;
[Symbol.iterator](): Iterator<[string, string]>;
}

View File

@ -159,10 +159,15 @@ function handlePromise(
});
}
function test_headersRaw() {
function test_headers() {
const headers = new Headers();
const myHeader = "foo";
headers.raw()[myHeader]; // $ExpectType string[]
[...headers]; // $ExpectType [string, string][]
[...headers.entries()]; // $ExpectType [string, string][]
[...headers.keys()]; // $ExpectType string[]
[...headers.values()]; // $ExpectType [string][]
}
function test_isRedirect() {

View File

@ -1,14 +1,11 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES6",
"lib": [
"es5",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"