I've written up the types declaration file as promised.
However, as you will notice (and I've left a comment about it for future reference), the functions / class methods have been needed to be written up twice because I cannot append each function to the class' prototype without defining them inside the class first, which then needs parameter and return types to be defined as well.
The solution to this would be to either go with the const arr = new AsyncArray('val1', 'val2') approach or the static method approach, where AsyncArray is a class you don't instantiate and use instead like AsyncArray.asyncMap((curVal, 0, ['hello', 'world']) => ...).then(...).
But that is if you'd like to make this types declaration file more maintainable in the future. It works, but the definitions just had to be written in two separate forms to match the two separate approaches of the package.
Hope you find this file to be to your liking. Any further issues, let me know.
I've written up the types declaration file as promised.
However, as you will notice (and I've left a comment about it for future reference), the functions / class methods have been needed to be written up twice because I cannot append each function to the class' prototype without defining them inside the class first, which then needs parameter and return types to be defined as well.
The solution to this would be to either go with the
const arr = new AsyncArray('val1', 'val2')
approach or the static method approach, whereAsyncArray
is a class you don't instantiate and use instead likeAsyncArray.asyncMap((curVal, 0, ['hello', 'world']) => ...).then(...)
.But that is if you'd like to make this types declaration file more maintainable in the future. It works, but the definitions just had to be written in two separate forms to match the two separate approaches of the package.
Hope you find this file to be to your liking. Any further issues, let me know.