File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ export type AbortSignal = typeof globalThis extends {
9
9
AbortSignal: {
10
10
prototype: infer T ;
11
11
};
12
- } ? T : never ;
12
+ } ? T : {
13
+ aborted: boolean ;
14
+ readonly reason? : any ;
15
+ addEventListener(type : ' abort' , listener : () => void ): void ;
16
+ removeEventListener(type : ' abort' , listener : () => void ): void ;
17
+ };
13
18
14
19
// @public
15
20
export class ByteLengthQueuingStrategy implements QueuingStrategy <ArrayBufferView > {
Original file line number Diff line number Diff line change 7
7
*
8
8
* @public
9
9
*/
10
- export type AbortSignal = typeof globalThis extends { AbortSignal : { prototype : infer T } } ? T : never ;
10
+ export type AbortSignal = typeof globalThis extends { AbortSignal : { prototype : infer T } } ? T : {
11
+ aborted : boolean ;
12
+ readonly reason ?: any ;
13
+ addEventListener ( type : 'abort' , listener : ( ) => void ) : void ;
14
+ removeEventListener ( type : 'abort' , listener : ( ) => void ) : void ;
15
+ } ;
11
16
12
17
export function isAbortSignal ( value : unknown ) : value is AbortSignal {
13
18
if ( typeof value !== 'object' || value === null ) {
@@ -31,7 +36,10 @@ export function isAbortSignal(value: unknown): value is AbortSignal {
31
36
*/
32
37
// Trick with globalThis inspired by @types /node
33
38
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0c370ead967cb97b1758d8fa15d09011fb3f58ea/types/node/globals.d.ts#L226
34
- export type AbortController = typeof globalThis extends { AbortController : { prototype : infer T } } ? T : never ;
39
+ export type AbortController = typeof globalThis extends { AbortController : { prototype : infer T } } ? T : {
40
+ readonly signal : AbortSignal ;
41
+ abort ( reason ?: any ) : void ;
42
+ } ;
35
43
36
44
/**
37
45
* Construct a new AbortController, if supported by the platform.
You can’t perform that action at this time.
0 commit comments