privatenumber / tasuku

✅ タスク — The minimal task visualizer for Node.js
MIT License
1.91k stars 30 forks source link

Export types #1

Closed ghost closed 3 years ago

ghost commented 3 years ago

I want to pass the task object to another function, like so.

import tsk, { TaskFunction } from 'tasuku'

async function scanPage(page: number, task: TaskFunction) {
    .......
    task.setOutput(`Scanning page ${page}...`)
    ........
}

tsk(
    'Scanning page',
    async (task) => {
        await scanPage(1, task)
    }
)

This doesn't work because TaskFunction is not exported. Great library otherwise though, congrats, I switched from listr2

privatenumber commented 3 years ago

Thanks @erikKeresztes

Does the solution in https://github.com/privatenumber/tasuku/pull/2 work for you?

ghost commented 3 years ago

Thanks @erikKeresztes

Does the solution in #2 work for you?

Yes, thank you