Skip to content

Commit bb03aec

Browse files
authored
🤖 Merge PR DefinitelyTyped#72207 feat(emscripten): Add preinitializedWebGPUDevice option to EmscriptenModule by @manzt
1 parent 79684a0 commit bb03aec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎types/emscripten/index.d.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ declare namespace Emscripten {
2323
}
2424
}
2525

26+
// Infers the type only in TypeScript environments where GPU types are available
27+
type MaybeGPUDevice = Navigator extends {
28+
gpu: {
29+
requestAdapter(...args: any[]): Promise<null | {
30+
requestDevice(...args: any[]): Promise<null | infer T>
31+
}>
32+
}
33+
} ? T : never;
34+
2635
interface EmscriptenModule {
2736
print(str: string): void;
2837
printErr(str: string): void;
@@ -34,6 +43,7 @@ interface EmscriptenModule {
3443
onAbort: { (what: any): void };
3544
onRuntimeInitialized: { (): void };
3645
preinitializedWebGLContext: WebGLRenderingContext;
46+
preinitializedWebGPUDevice: MaybeGPUDevice;
3747
noInitialRun: boolean;
3848
noExitRuntime: boolean;
3949
logReadFiles: boolean;

0 commit comments

Comments
 (0)