im_wower
·
2026-03-22
node-shims.d.ts
1declare namespace NodeJS {
2 interface ProcessEnv {
3 [key: string]: string | undefined;
4 }
5}
6
7declare interface BaaCodexExecReadableStream {
8 on(event: "data", listener: (chunk: string | Uint8Array) => void): void;
9 setEncoding(encoding: string): void;
10}
11
12declare interface BaaCodexExecChildProcess {
13 kill(signal?: string): boolean;
14 once(event: "error", listener: (error: Error) => void): void;
15 once(
16 event: "close",
17 listener: (exitCode: number | null, signal: string | null) => void
18 ): void;
19 stderr: BaaCodexExecReadableStream | null;
20 stdout: BaaCodexExecReadableStream | null;
21}
22
23declare module "node:child_process" {
24 export function spawn(
25 command: string,
26 args?: string[],
27 options?: {
28 cwd?: string;
29 env?: NodeJS.ProcessEnv;
30 stdio?: string[];
31 }
32 ): BaaCodexExecChildProcess;
33}
34
35declare module "node:fs/promises" {
36 export function mkdtemp(prefix: string): Promise<string>;
37 export function readFile(path: string, encoding: "utf8"): Promise<string>;
38 export function rm(
39 path: string,
40 options: {
41 force?: boolean;
42 recursive?: boolean;
43 }
44 ): Promise<void>;
45}
46
47declare module "node:os" {
48 export function tmpdir(): string;
49}
50
51declare module "node:path" {
52 export function join(...paths: string[]): string;
53}
54
55declare const process: {
56 cwd(): string;
57 env: NodeJS.ProcessEnv;
58};
59
60declare function clearTimeout(handle: number | undefined): void;
61declare function setTimeout(callback: () => void, delay?: number): number;