typings: share AsyncWrap and HandleWrap types · nodejs/node@0845991 · GitHub
Skip to content

Commit 0845991

Browse files
leah-1eeaduh95
authored andcommitted
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: #66150 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent be7f637 commit 0845991

4 files changed

Lines changed: 23 additions & 8 deletions

File tree

‎typings/internalBinding/async_wrap.d.ts‎

Lines changed: 7 additions & 0 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { AsyncWrap } from './async_wrap';
2+
3+
export interface HandleWrap extends AsyncWrap {
4+
close(callback?: () => void): void;
5+
hasRef(): boolean;
6+
ref(): void;
7+
unref(): void;
8+
}

‎typings/internalBinding/signal_wrap.d.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import type { HandleWrap } from './handle_wrap';
2+
13
declare namespace InternalSignalWrapBinding {
24
class Signal {
35
constructor();
46
onsignal?: (signum: number) => void;
57
start(signum: number): number | undefined;
68
stop(): number;
7-
close(callback?: () => void): void;
8-
hasRef(): boolean;
9-
ref(): void;
10-
unref(): void;
119
}
10+
11+
interface Signal extends HandleWrap {}
1212
}
1313

1414
export interface SignalWrapBinding {

‎typings/internalBinding/watchdog.d.ts‎

Lines changed: 4 additions & 4 deletions

0 commit comments

Comments
 (0)