-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91bf895
commit 74fb529
Showing
3 changed files
with
52 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
import { EventTarget } from 'event-target-shim'; | ||
import { EventTarget } from "event-target-shim" | ||
|
||
export declare type Events = { | ||
abort: any; | ||
}; | ||
export declare type EventAttributes = { | ||
onabort: any; | ||
}; | ||
type Events = { | ||
abort: any | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mysticatea
Author
Owner
|
||
} | ||
type EventAttributes = { | ||
onabort: any | ||
} | ||
/** | ||
* The signal class. | ||
* @see https://dom.spec.whatwg.org/#abortsignal | ||
*/ | ||
export declare class AbortSignal extends EventTarget<Events, EventAttributes> { | ||
/** | ||
* AbortSignal cannot be constructed directly. | ||
*/ | ||
constructor(); | ||
/** | ||
* Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. | ||
*/ | ||
readonly aborted: boolean; | ||
declare class AbortSignal extends EventTarget<Events, EventAttributes> { | ||
/** | ||
* AbortSignal cannot be constructed directly. | ||
*/ | ||
constructor() | ||
/** | ||
* Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise. | ||
*/ | ||
readonly aborted: boolean | ||
} | ||
/** | ||
* The AbortController. | ||
* @see https://dom.spec.whatwg.org/#abortcontroller | ||
*/ | ||
export default 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 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 | ||
} | ||
|
||
export default AbortController | ||
export { AbortController, AbortSignal } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fs from "fs" | ||
|
||
fs.writeFileSync( | ||
"dist/abort-controller.d.ts", | ||
[ | ||
fs | ||
.readFileSync("dist/abort-controller.d.ts", "utf8") | ||
.replace(/export declare type/gu, "type") | ||
.replace(/export (?:declare|default) class/gu, "declare class") | ||
.replace(/\t/gu, " ") | ||
.replace(/'/gu, '"') | ||
.replace(/;\n/gu, "\n"), | ||
"", | ||
"export default AbortController", | ||
"export { AbortController, AbortSignal }", | ||
"", | ||
].join("\n"), | ||
) |
Why is this
any
? This makes 2.0.0 a regression for TS users who used the global types before (now TypeScript will use these types)