Open
Description
Is your feature request related to a problem? Please describe.
This code:
async function foo(): Promise<string> {
return "foo";
}
const result = await new MockActivityEnvironment().run(foo);
result.startsWith("foo");
Does not compile with strict types because result
is inferred to be unknown
instead of string
.
Describe the solution you'd like
Change the signature of MockActivityEnvironment.run
from:
run<P extends any[], R, F extends ActivityFunction<P, R>>(fn: F, ...args: P): Promise<R>;
to
run<F extends ActivityFunction>(fn: F, ...args: Parameters<F>): ReturnType<F>
I've checked this locally and it makes my example infer the type of result
correctly.