import { call, createContext, useContext, withContext, createFunc, toPromise } from "./../.."; const Context1 = createContext(); const concat = createFunc((...args: string[]) => { const cont1 = useContext(Context1); args.push(cont1); return args.join("_"); }); const func2 = createFunc((param1: string) => { const cont1 = useContext(Context1); withContext(Context1, "ContextFromFunc2"); return call(concat(param1, cont1)); }); const func1 = createFunc(() => { const param1 = useContext(Context1); withContext(Context1, "ContextFromFunc1"); return call(func2(param1)); }); toPromise(func1(), [{ context: Context1, value: "Context1InitValue" }]) .then((value) => { console.log("Result: " + value); }) .catch((err) => console.log(err));