be3eb26d8c36378c49252262a5b33247918051bcc2dfaf19fb8012cde094ad2d347c6bcbc99d3747972d5d1cc480c660670dfc35e0628064fc8d2aacf15f20 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. export {};
  2. type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
  3. interface AbortController {
  4. readonly signal: AbortSignal;
  5. abort(reason?: any): void;
  6. }
  7. type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
  8. interface AbortSignal extends EventTarget {
  9. readonly aborted: boolean;
  10. onabort: ((this: AbortSignal, ev: Event) => any) | null;
  11. readonly reason: any;
  12. throwIfAborted(): void;
  13. }
  14. declare global {
  15. interface AbortController extends _AbortController {}
  16. var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
  17. : {
  18. prototype: AbortController;
  19. new(): AbortController;
  20. };
  21. interface AbortSignal extends _AbortSignal {}
  22. var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
  23. : {
  24. prototype: AbortSignal;
  25. new(): AbortSignal;
  26. abort(reason?: any): AbortSignal;
  27. any(signals: AbortSignal[]): AbortSignal;
  28. timeout(milliseconds: number): AbortSignal;
  29. };
  30. }