Commit 44ff2db1e67 for nodejs
commit 44ff2db1e671f3b68e9a1006e1920770f8ec0140
Author: Seongeun Lee <selee3196@gmail.com>
Date: Tue Sep 22 16:19:54 2026 +0900
typings: share AsyncWrap and HandleWrap types
Add reusable AsyncWrap and HandleWrap interfaces and use them for
signal_wrap and watchdog typings.
This reflects the native inheritance hierarchy and exposes AsyncWrap
methods that are already available at runtime.
Signed-off-by: leah-1ee <selee3196@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66150
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
diff --git a/typings/internalBinding/async_wrap.d.ts b/typings/internalBinding/async_wrap.d.ts
index 0bcff6e30c6..88659a5b39e 100644
--- a/typings/internalBinding/async_wrap.d.ts
+++ b/typings/internalBinding/async_wrap.d.ts
@@ -1,5 +1,12 @@
import { owner_symbol } from './symbols';
+export interface AsyncWrap {
+ getAsyncId(): number;
+ asyncReset(resource: object, executionAsyncId?: number): void;
+ getAsyncContextFrameForDebuggingOnly(): unknown;
+ getProviderType(): number;
+}
+
declare namespace InternalAsyncWrapBinding {
interface Resource {
[owner_symbol]?: PublicResource;
diff --git a/typings/internalBinding/handle_wrap.d.ts b/typings/internalBinding/handle_wrap.d.ts
new file mode 100644
index 00000000000..31f65e85e52
--- /dev/null
+++ b/typings/internalBinding/handle_wrap.d.ts
@@ -0,0 +1,8 @@
+import type { AsyncWrap } from './async_wrap';
+
+export interface HandleWrap extends AsyncWrap {
+ close(callback?: () => void): void;
+ hasRef(): boolean;
+ ref(): void;
+ unref(): void;
+}
diff --git a/typings/internalBinding/signal_wrap.d.ts b/typings/internalBinding/signal_wrap.d.ts
index 4c6473cbee2..bfcfb92f082 100644
--- a/typings/internalBinding/signal_wrap.d.ts
+++ b/typings/internalBinding/signal_wrap.d.ts
@@ -1,14 +1,14 @@
+import type { HandleWrap } from './handle_wrap';
+
declare namespace InternalSignalWrapBinding {
class Signal {
constructor();
onsignal?: (signum: number) => void;
start(signum: number): number | undefined;
stop(): number;
- close(callback?: () => void): void;
- hasRef(): boolean;
- ref(): void;
- unref(): void;
}
+
+ interface Signal extends HandleWrap {}
}
export interface SignalWrapBinding {
diff --git a/typings/internalBinding/watchdog.d.ts b/typings/internalBinding/watchdog.d.ts
index 917ee3b96d4..f57f90b7ea3 100644
--- a/typings/internalBinding/watchdog.d.ts
+++ b/typings/internalBinding/watchdog.d.ts
@@ -1,13 +1,13 @@
+import type { HandleWrap } from './handle_wrap';
+
declare namespace InternalWatchdogBinding {
class TraceSigintWatchdog {
constructor();
start(): void;
stop(): void;
- close(callback?: () => void): void;
- hasRef(): boolean;
- ref(): void;
- unref(): void;
}
+
+ interface TraceSigintWatchdog extends HandleWrap {}
}
export interface WatchdogBinding {