-
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Using latest version of all packages at time of writing:
package.json:
{
"dependencies": {
"@types/node": "^17.0.42",
"abort-controller": "^3.0.0",
"typescript": "^4.7.3"
}
}
main.ts:
import AbortController from "abort-controller";
/*
Type 'typeof AbortController' is not assignable to type '{ new (): AbortController; prototype: AbortController; }'.
The types of 'prototype.signal' are incompatible between these types.
Type 'AbortSignal' is missing the following properties from type 'AbortSignal': reason, throwIfAborted
*/
globalThis.AbortController = AbortController;
We can fix it by using the global AbortController type:
diff --git a/node_modules/abort-controller/dist/abort-controller.d.ts b/node_modules/abort-controller/dist/abort-controller.d.ts
index 75852fb..aa25471 100644
--- a/node_modules/abort-controller/dist/abort-controller.d.ts
+++ b/node_modules/abort-controller/dist/abort-controller.d.ts
@@ -24,20 +24,6 @@ declare class AbortSignal extends EventTarget<Events, EventAttributes> {
* The AbortController.
* @see https://dom.spec.whatwg.org/#abortcontroller
*/
-declare class AbortController {
- /**
- * Initialize this controller.
- */
- constructor()
- /**
- * Returns the `AbortSignal` object associated with this object.
- */
- readonly signal: AbortSignal
- /**
- * Abort and signal to any observers that the associated activity is to be aborted.
- */
- abort(): void
-}
-
+declare const AbortController: typeof globalThis.AbortController;
export default AbortController
export { AbortController, AbortSignal }Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels