From 035f30f469ab4c7491f5f9d95d05eb4edda22c69 Mon Sep 17 00:00:00 2001 From: leah-1ee Date: Sat, 3 Oct 2026 00:43:43 +0900 Subject: [PATCH] typings: use HandleWrap for derived types Reuse HandleWrap across derived internal binding types. Assisted-by: Codex Signed-off-by: leah-1ee --- typings/internalBinding/fs.d.ts | 7 +++---- typings/internalBinding/fs_event_wrap.d.ts | 7 +++---- typings/internalBinding/performance.d.ts | 12 +++--------- typings/internalBinding/process_wrap.d.ts | 6 +++--- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/typings/internalBinding/fs.d.ts b/typings/internalBinding/fs.d.ts index 6e1702996dfc..f46de16984e1 100644 --- a/typings/internalBinding/fs.d.ts +++ b/typings/internalBinding/fs.d.ts @@ -1,4 +1,5 @@ import { ConstantsBinding } from './constants'; +import type { HandleWrap } from './handle_wrap'; interface ReadFileContext { fd: number | undefined; @@ -49,13 +50,11 @@ declare namespace InternalFSBinding { constructor(useBigint: boolean); initialized: boolean; start(path: string, interval: number): number; - getAsyncId(): number; - close(): void; - ref(): void; - unref(): void; onchange: (status: number, eventType: string, filename: string | Buffer) => void; } + interface StatWatcher extends HandleWrap {} + function access(path: StringOrBuffer, mode: number, req: FSReqCallback): void; function access(path: StringOrBuffer, mode: number): void; function access(path: StringOrBuffer, mode: number, usePromises: typeof kUsePromises): Promise; diff --git a/typings/internalBinding/fs_event_wrap.d.ts b/typings/internalBinding/fs_event_wrap.d.ts index b1b815e8a35e..83a2195209a7 100644 --- a/typings/internalBinding/fs_event_wrap.d.ts +++ b/typings/internalBinding/fs_event_wrap.d.ts @@ -1,3 +1,4 @@ +import type { HandleWrap } from './handle_wrap'; import { owner_symbol } from './symbols'; declare namespace InternalFsEventWrapBinding { @@ -16,11 +17,9 @@ declare namespace InternalFsEventWrapBinding { recursive: boolean, encoding: string, ): number; - close(callback?: () => void): void; - hasRef(): boolean; - ref(): void; - unref(): void; } + + interface FSEvent extends HandleWrap {} } export interface FsEventWrapBinding { diff --git a/typings/internalBinding/performance.d.ts b/typings/internalBinding/performance.d.ts index abf07578a4a7..fff4838947cc 100644 --- a/typings/internalBinding/performance.d.ts +++ b/typings/internalBinding/performance.d.ts @@ -1,3 +1,5 @@ +import type { HandleWrap } from './handle_wrap'; + declare namespace InternalPerformanceBinding { interface HistogramBase { count(): number; @@ -46,17 +48,9 @@ declare namespace InternalPerformanceBinding { resetCount(): number; } - interface ELDHistogram extends HistogramBase { + interface ELDHistogram extends HistogramBase, HandleWrap { start(reset?: boolean): void; stop(): void; - close(callback?: () => void): void; - hasRef(): boolean; - ref(): void; - unref(): void; - getAsyncId(): number; - asyncReset(resource: object, executionAsyncId?: number): void; - getAsyncContextFrameForDebuggingOnly(): unknown; - getProviderType(): number; } interface Histogram extends HistogramBase {} diff --git a/typings/internalBinding/process_wrap.d.ts b/typings/internalBinding/process_wrap.d.ts index 8e5ab490ef97..9ba347541242 100644 --- a/typings/internalBinding/process_wrap.d.ts +++ b/typings/internalBinding/process_wrap.d.ts @@ -1,3 +1,4 @@ +import type { HandleWrap } from './handle_wrap'; import { owner_symbol } from './symbols'; declare namespace InternalProcessWrapBinding { @@ -25,11 +26,10 @@ declare namespace InternalProcessWrapBinding { gid: number | null | undefined, ): number; kill(signal: number): number; - ref(): void; - unref(): void; - close(callback?: () => void): void; } + interface Process extends HandleWrap {} + interface ProcessConstants { kProcessFlagDetached: number; kProcessFlagWindowsHide: number;