Hi , I'm trying to make a type that accepts a dict/object of user defined functions of type (...args: unknown[]) => Promise<unknown> and will return a function of type (functionId: E,...args: [infered from args FunctionMap[E]]) => Promise<[infered from return type of FunctionMap[E]>
right now I have
export type BatchedScript<ScriptMap extends { [key: string]: (...args: unknown[]) => Promise<unknown>},Id extends keyof ScriptMap = keyof ScriptMap> = (functionId: Id,...args: Parameters<ScriptMap[Id]>) => ReturnType<ScriptMap[Id]>
declare const c: BatchedScript<{
foo : () => Promise<boolean>;
bar: () => Promise<{
nested: boolean;
}>
}>;
but when I do c("foo") the return type says
Promise<boolean> | Promise<{
nested: boolean;
}>```
instead of `Promise<boolean>`