gulpjs / async-done

Allows libraries to handle various caller provided asynchronous functions uniformly. Maps promises, observables, child processes and streams, and callbacks to callback style.
MIT License
69 stars 21 forks source link

Typings (typescript declarations) would be helpful #41

Closed BurtHarris closed 6 years ago

BurtHarris commented 7 years ago

The argument types and expected returns could be expressed in a typescript declarations .d.ts file, which would enable editors like VSCode to provide some help with using this function.

The big restriction, re not supporting synchronous functions, might be hard to define in typescript. Though I write in TypeScript, the API to this is complex enough that writing the definitions file for this project may be over my head. But the expressive goodness of this should bubble up to packages like Gulp where mistakes over sync/async are more common.

phated commented 7 years ago

I'm actually working on a project with TypeScript right now, so I'm learning more about .d.ts files. I might eventually be able to get this but I feel confident I can review a PR now.

BurtHarris commented 7 years ago

Let's keep this open. I can't work on it right, but might take a stab at it.

phated commented 6 years ago

@demurgos want to help out with this?

demurgos commented 6 years ago

Yup, I had this in mind for some time, so it's the occasion. I updated my projects last week and async-done is the last library I use that still does not have published types 😛. I just need to clean the custom types I use, I just wrote them to fix my issue and move on a few years ago so they are not ready yet. (I want to double-check with the doc and source code, add documentation and fix the signature of the done callback). It shouldn't take too long: I'll send a PR on Thursday probably.

phated commented 6 years ago

@demurgos awesome! I didn't realize you made turbo-gulp - have you thought of converting it to a custom registry instead of wrapping gulp? https://github.com/gulpjs/undertaker#custom-registries

demurgos commented 6 years ago

Yes, this is something I had in mind for some time.

I created this library about 2-3 years ago and it has gone through a lot of change. I did a big clean-up during the summer and I feel that it now reached a reasonable state. I still need to document it more because for the moment it remains a personal tool. My goal is to have a declarative interface for Gulp that is less customizable but provides a complete set of tools out-of-the-box. I agree that it should return a custom registry: I am currently returning an object with all the tasks so the design is already pretty close. I wanted to switch to custom registries but did not have time to do it yet. Thanks for the advice.

BurtHarris commented 6 years ago

@demurgos, thank you.

turbo-gulp looks quite interesting, I'll try it out on my TypeScript ANTLR project antlr4ts.

demurgos commented 6 years ago

Thanks. I'd recommend to wait a week or so: I am getting rid of the web stuff to focus on Node libs and applicatications. I am also in the process of updating the doc and writing a guide.