DEV: Enhance type definitions for Meteor methods

This commit is contained in:
Welkin Wong
2025-04-08 15:32:06 +08:00
parent d185a3487d
commit 9370fdfd9c

View File

@@ -162,14 +162,26 @@ export namespace Meteor {
* @param name Name of method to invoke
* @param args Optional method arguments
*/
function call(name: string, ...args: any[]): any;
function call<
Result extends
| EJSONable
| EJSONable[]
| EJSONableProperty
| EJSONableProperty[]
>(name: string, ...args: any[]): Result;
/**
* Invokes a method with an async stub, passing any number of arguments.
* @param name Name of method to invoke
* @param args Optional method arguments
*/
function callAsync(name: string, ...args: any[]): Promise<any>;
function callAsync<
Result extends
| EJSONable
| EJSONable[]
| EJSONableProperty
| EJSONableProperty[]
>(name: string, ...args: any[]): Promise<Result> & { stubPromise: Promise<Result>, serverPromise: Promise<Result> };
interface MethodApplyOptions<
Result extends
@@ -226,7 +238,7 @@ export namespace Meteor {
error: global_Error | Meteor.Error | undefined,
result?: Result
) => void
): any;
): Result;
/**
* Invokes a method with an async stub, passing any number of arguments.
@@ -249,7 +261,7 @@ export namespace Meteor {
error: global_Error | Meteor.Error | undefined,
result?: Result
) => void
): Promise<Result>;
): Promise<Result> & { stubPromise: Promise<Result>, serverPromise: Promise<Result> };
/** Method **/
/** Url **/