mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
node-fetch: correct Headers.raw type (#27364)
* `node-fetch`: add test for `Headers.raw` * `node-fetch`: `Headers.raw`: add `string[]` to index signature value type * `node-fetch`: `Headers.raw`: add `undefined` to index signature value type * `node-fetch`: enable `strictNullChecks` and fix errors * Revert "`node-fetch`: `Headers.raw`: add `undefined` to index signature value type" This reverts commit 15ad14d72c42fa1f3ba472bc15f38a88230f3a4f. * Fix expect type format * Remove string
This commit is contained in:
committed by
Wesley Wigham
parent
b7ba5e828b
commit
aee338f484
Vendored
+1
-1
@@ -102,7 +102,7 @@ export class Headers implements Iterable<[string, string]> {
|
||||
get(name: string): string | null;
|
||||
getAll(name: string): string[];
|
||||
has(name: string): boolean;
|
||||
raw(): { [k: string]: string };
|
||||
raw(): { [k: string]: string[] };
|
||||
set(name: string, value: string): void;
|
||||
|
||||
// Iterator methods
|
||||
|
||||
@@ -44,7 +44,7 @@ function test_fetchUrlWithRequestObject() {
|
||||
const request: Request = new Request("http://www.andlabs.net/html5/uCOR.php", requestOptions);
|
||||
const timeout: number = request.timeout;
|
||||
const size: number = request.size;
|
||||
const agent: Agent = request.agent;
|
||||
const agent: Agent | undefined = request.agent;
|
||||
const protocol: string = request.protocol;
|
||||
|
||||
handlePromise(fetch(request));
|
||||
@@ -71,3 +71,9 @@ function handlePromise(promise: Promise<Response>, isArrayBuffer: boolean = fals
|
||||
console.log(text);
|
||||
});
|
||||
}
|
||||
|
||||
function test_headersRaw() {
|
||||
const headers = new Headers();
|
||||
const myHeader = 'foo';
|
||||
headers.raw()[myHeader]; // $ExpectType string[]
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
Reference in New Issue
Block a user