mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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>
This commit is contained in:
1 parent
56471e45c2
commit
7c62da0585
4 files changed
+23
-8
No files matched your search
+7
@@ -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;
|
||||
|
||||
+8
@@ -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;
|
||||
}
|
||||
+4
-4
@@ -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 {
|
||||
|
||||
+4
-4
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user