2

How do we strongly type each of the async auto tasks? let's say get_data returns a number and email_link returns a string and I finally want to return the email_link task. I am unable to figure out how to strongly type each of those tasks and the result value.

async () => {
try {
    let results = await async.auto({
        get_data: async function() {
            // async code to get some data
            return someNumber;
        },
        make_folder: async function () {
            // async code to create a directory to store a file in
            // this is run at the same time as getting the data
           return something;
        },

        email_link: ['write_file', async function() {
            // once the file is written let's email a link to it...
            return someString;
        }]
    });
    console.log('results = ', results);
   return results.email_link;
}
catch (err) {
    console.log(err);
}

}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.