@forge/bridge
5.15.2-next.0-experimental-5b726e65.16.0-next.1
out/invoke/invoke.d.ts~
out/invoke/invoke.d.tsModified+25−2
Index: package/out/invoke/invoke.d.ts
===================================================================
--- package/out/invoke/invoke.d.ts
+++ package/out/invoke/invoke.d.ts
@@ -1,7 +1,30 @@
import type { Definitions, DefArguments, DefResult } from '@forge/resolver/shared';
-import { InvokePayload } from '../types';
-export declare const invoke: <T>(functionKey: string, payload?: InvokePayload | undefined) => Promise<T>;
+import { InvokePayload, InvokeResponse } from '../types';
+/**
+ * Calls a resolver function with explicit payload and return types.
+ *
+ * The first generic is the payload shape and the second generic is the return type.
+ * When this overload is used, payload is required.
+ *
+ * @example
+ * type Payload = { name: string };
+ * type Response = { message: string };
+ * const response = await invoke<Payload, Response>('greet', { name: 'Taylor' });
+ */
+export declare function invoke<Payload extends InvokePayload, T = InvokeResponse>(functionKey: string, payload: Payload): Promise<T>;
+/**
+ * Calls a resolver function using the legacy generic form where the type argument is the return type.
+ *
+ * @example
+ * const response = await invoke<{ message: string }>('greet', { name: 'Taylor' });
+ */
+export declare function invoke<T = InvokeResponse>(functionKey: string, payload?: InvokePayload): Promise<T>;
declare type Invoke<Defs extends Definitions> = <Def extends keyof Defs & string>(call: Def, ...arg: DefArguments<Defs, Def>) => Promise<DefResult<Defs, Def>>;
+/**
+ * Specialises the invoke function to a given Definitions type.
+ *
+ * @returns An invoke function that can be used to call backend functions.
+ */
export declare function makeInvoke<Defs extends Definitions>(): Invoke<Defs>;
export {};
//# sourceMappingURL=invoke.d.ts.map
\ No newline at end of file