aboutsummaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 19:33:01 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 19:33:01 -0500
commit14d12f6ba20b837a04c638b935773f3120e194ff (patch)
treedcd6b61d51ff39c97b60812b2bf3c8cd564347f8 /types
parentd5b1217df3fe7480fc5f58fe194f5bbf73281094 (diff)
Update timer types and such
Diffstat (limited to 'types')
-rw-r--r--types/ext/core.d.ts2
-rw-r--r--types/ext/cross-frame-api.d.ts2
-rw-r--r--types/ext/offscreen.d.ts2
-rw-r--r--types/other/globals.d.ts (renamed from types/other/web-set-timeout.d.ts)10
4 files changed, 8 insertions, 8 deletions
diff --git a/types/ext/core.d.ts b/types/ext/core.d.ts
index ce3a09f0..b83e6a74 100644
--- a/types/ext/core.d.ts
+++ b/types/ext/core.d.ts
@@ -100,3 +100,5 @@ export type MessageHandlerDetails = {
export type MessageHandlerMap = Map<string, MessageHandlerDetails>;
export type MessageHandlerArray = [key: string, handlerDetails: MessageHandlerDetails][];
+
+export type Timeout = number | NodeJS.Timeout;
diff --git a/types/ext/cross-frame-api.d.ts b/types/ext/cross-frame-api.d.ts
index 5cedbec9..88ce59a7 100644
--- a/types/ext/cross-frame-api.d.ts
+++ b/types/ext/cross-frame-api.d.ts
@@ -50,5 +50,5 @@ export type Invocation = {
responseTimeout: number;
action: string;
ack: boolean;
- timer: number | null;
+ timer: Core.Timeout | null;
};
diff --git a/types/ext/offscreen.d.ts b/types/ext/offscreen.d.ts
index 7dd64d1e..ddf7eadc 100644
--- a/types/ext/offscreen.d.ts
+++ b/types/ext/offscreen.d.ts
@@ -112,4 +112,4 @@ export type MessageHandler<
details: MessageDetailsMap[TMessage],
) => (TIsAsync extends true ? Promise<MessageReturn<TMessage>> : MessageReturn<TMessage>);
-export type MessageHandlerMap = Map<MessageType, Core.MessageHandlerDetails>;
+export type MessageHandlerMap<T = MessageType> = Map<T, Core.MessageHandlerDetails>;
diff --git a/types/other/web-set-timeout.d.ts b/types/other/globals.d.ts
index 98e40dab..330f16c2 100644
--- a/types/other/web-set-timeout.d.ts
+++ b/types/other/globals.d.ts
@@ -15,10 +15,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-declare module 'web-set-timeout' {
- global {
- // These types are used to ensure that setTimeout returns a number
- function setTimeout<TArgs extends unknown[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): number;
- function setTimeout(callback: (args: void) => void, ms?: number): number;
- }
+declare global {
+ function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
}
+
+export {};