From c98b4b6ec6629f30daac83c7860d342d2e13d329 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Fri, 3 Mar 2023 20:52:01 -0800 Subject: [PATCH] Internal change PiperOrigin-RevId: 513992315 --- mediapipe/web/graph_runner/graph_runner.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mediapipe/web/graph_runner/graph_runner.ts b/mediapipe/web/graph_runner/graph_runner.ts index 795cd4061..4417f6a03 100644 --- a/mediapipe/web/graph_runner/graph_runner.ts +++ b/mediapipe/web/graph_runner/graph_runner.ts @@ -1123,6 +1123,18 @@ async function runScript(scriptUrl: string) { } } +/** + * Helper type macro for use with createMediaPipeLib. Allows us to easily infer + * the type of a mixin-extended GraphRunner. Example usage: + * const GraphRunnerConstructor = + * SupportImage(SupportSerialization(GraphRunner)); + * let mediaPipe: ReturnType; + * ... + * mediaPipe = await createMediaPipeLib(GraphRunnerConstructor, ...); + */ +// tslint:disable-next-line:no-any +export type ReturnType = T extends (...args: unknown[]) => infer R ? R : any; + /** * Global function to initialize Wasm blob and load runtime assets for a * specialized MediaPipe library. This allows us to create a requested