node-fetch/@types/index.test-d.ts

96 lines
2.9 KiB
TypeScript
Raw Normal View History

Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
import {expectType, expectAssignable} from 'tsd';
import AbortController from 'abort-controller';
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
import Blob from 'fetch-blob';
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
import fetch, {Request, Response, Headers, Body, FetchError, AbortError} from '.';
import * as _fetch from '.';
async function run() {
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
const getResponse = await fetch('https://bigfile.com/test.zip');
expectType<boolean>(getResponse.ok);
expectType<number>(getResponse.size);
expectType<number>(getResponse.status);
expectType<string>(getResponse.statusText);
expectType<() => Response>(getResponse.clone);
// Test async iterator over body
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
expectType<NodeJS.ReadableStream | null>(getResponse.body);
if (getResponse.body) {
for await (const data of getResponse.body) {
expectType<Buffer | string>(data);
}
}
// Test Buffer
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
expectType<Buffer>(await getResponse.buffer());
// Test arrayBuffer
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
expectType<ArrayBuffer>(await getResponse.arrayBuffer());
// Test JSON, returns unknown
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
expectType<unknown>(await getResponse.json());
// Headers iterable
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
expectType<Headers>(getResponse.headers);
// Post
try {
const request = new Request('http://byjka.com/buka');
expectType<string>(request.url);
expectType<Headers>(request.headers);
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
const headers = new Headers({byaka: 'buke'});
expectType<(a: string, b: string) => void>(headers.append);
expectType<(a: string) => string | null>(headers.get);
expectType<(name: string, value: string) => void>(headers.set);
expectType<(name: string) => void>(headers.delete);
expectType<() => IterableIterator<string>>(headers.keys);
expectType<() => IterableIterator<[string, string]>>(headers.entries);
expectType<() => IterableIterator<[string, string]>>(headers[Symbol.iterator]);
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
const postResponse = await fetch(request, {method: 'POST', headers});
expectType<Blob>(await postResponse.blob());
} catch (error: unknown) {
if (error instanceof FetchError) {
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
throw new TypeError(error.errno as string | undefined);
}
if (error instanceof AbortError) {
throw error;
}
}
// export *
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
const wildResponse = await _fetch.default('https://google.com');
expectType<boolean>(wildResponse.ok);
expectType<number>(wildResponse.size);
expectType<number>(wildResponse.status);
expectType<string>(wildResponse.statusText);
expectType<() => Response>(wildResponse.clone);
// Others
const response = new Response();
expectType<string>(response.url);
expectAssignable<Body>(response);
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
const abortController = new AbortController();
const request = new Request('url', {signal: abortController.signal});
expectAssignable<Body>(request);
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
/* eslint-disable no-new */
new Headers({Header: 'value'});
// new Headers(['header', 'value']); // should not work
new Headers([['header', 'value']]);
new Headers(new Headers());
new Headers([
new Set(['a', '1']),
['b', '2'],
new Map([['a', null], ['3', null]]).keys()
]);
Require Node.js 12.20.0 and move to ESM (#1141) * Use ESM import in runkit example file * Update dependencies, version and transition to ESM * Use ESM imports, add ESM-related info * Remove rollup * Lint TypeScript-related files * Update dependency * Lint & update dependency * Lint * Remove commonjs tests * chore: update changelog * Remove commonjs GitHub action * Update funding.yml * Update linter rules * Lint * Fix tsd * Remove unnecessary types * Simplify * Use top-level await * Update GitHub Actions * Use Mocha with ESM * Revamp * specify what node version * update formdata-node dep * remove lint from example using top await * updated name and link to formdata-polyfill * Stop recommend form-data * filter example - it has many duplicate variables * Update type definitions to ESM * Remove unused lint rule disable comment * Remove leftover rollup and dist folder * updated depn * updated d.ts * lint * Fix breaking changes with blob v3 stream() * revert eslint comment * revert back to xo 0.39 Don't want to deal with all those new rules right now. will fix it later fixed some of them... * none TS fan trying to fix type definition * Give me a break * Test on all minimum supported Node.js versions (#1170) * Test on all minimum supported Node.js versions * Tweak Node.js workaround version range * Handle Node.js 16 aborted error message * fix node version string compare Co-authored-by: Jimmy Wärting <jimmy@warting.se> * bumped fetch-blob version * import from dom lib * rm unused comment * updated required version in docs * fixed named import * set lowest support to 12.20.0 * comment explaining both * rm log Co-authored-by: Jimmy Wärting <jimmy@warting.se> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
2021-07-18 13:15:19 -07:00
/* eslint-enable no-new */
}
run().finally(() => {
console.log('✅');
});