refactor: Use built-in AbortSignal for typings (#747)

* refactor: Use built-in AbortSignal for typings

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* lint

* chore: Update dependencies

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
This commit is contained in:
Richie Bendall 2020-04-15 00:22:40 +12:00 committed by GitHub
parent d15476bb5d
commit ebbf45cc67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 24 deletions

21
externals.d.ts vendored
View File

@ -1,21 +0,0 @@
// `AbortSignal` is defined here to prevent a dependency on a particular
// implementation like the `abort-controller` package, and to avoid requiring
// the `dom` library in `tsconfig.json`.
export interface AbortSignal {
aborted: boolean;
addEventListener: (type: 'abort', listener: ((this: AbortSignal, event: any) => any), options?: boolean | {
capture?: boolean;
once?: boolean;
passive?: boolean;
}) => void;
removeEventListener: (type: 'abort', listener: ((this: AbortSignal, event: any) => any), options?: boolean | {
capture?: boolean;
}) => void;
dispatchEvent: (event: any) => boolean;
onabort?: null | ((this: AbortSignal, event: any) => void);
}

5
index.d.ts vendored
View File

@ -9,9 +9,8 @@
/// <reference types="node" />
import { URL, URLSearchParams } from 'url';
import { Agent } from 'http';
import { AbortSignal } from './externals';
import {URL, URLSearchParams} from 'url';
import {Agent} from 'http';
export class Request extends Body {
method: string;