Skip to content

Commit

Permalink
typings: provide internal types for wasi bindings
Browse files Browse the repository at this point in the history
PR-URL: #54119
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
  • Loading branch information
RulerOfCakes authored and RafaelGSS committed Aug 30, 2024
1 parent fc08a9b commit 16d4c43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions typings/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { TimersBinding } from './internalBinding/timers';
import { TypesBinding } from './internalBinding/types';
import { URLBinding } from './internalBinding/url';
import { UtilBinding } from './internalBinding/util';
import { WASIBinding } from './internalBinding/wasi';
import { WorkerBinding } from './internalBinding/worker';
import { ModulesBinding } from './internalBinding/modules';

Expand Down Expand Up @@ -50,6 +51,7 @@ interface InternalBindingMap {
types: TypesBinding;
url: URLBinding;
util: UtilBinding;
wasi: WASIBinding;
worker: WorkerBinding;
}

Expand Down
14 changes: 14 additions & 0 deletions typings/internalBinding/wasi.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare namespace InternalWASIBinding {
type EnvStr = `${string}=${string}`

class WASI {
constructor(args: string[], env: EnvStr[], preopens: string[], stdio: [stdin: number, stdout: number, stderr: number])

_setMemory(memory: WebAssembly.Memory): void;
}
}

export interface WASIBinding {
WASI: typeof InternalWASIBinding.WASI;
}

0 comments on commit 16d4c43

Please sign in to comment.