# Working with js.lib.Promise

**URL:** <https://community.haxe.org/t/working-with-js-lib-promise/2865>\
**Category:** Haxe\
**Tags:** haxe-js\
**Created:** [January 24, 2021, 8:29pm UTC](https://community.haxe.org/t/working-with-js-lib-promise/2865 "2021-01-24T20:29:48Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![basro](https://community.haxe.org/user_avatar/community.haxe.org/basro/32/738_2.png) [@basro](https://community.haxe.org/u/basro)\
**Post date:** [January 25, 2021, 12:05pm UTC](https://community.haxe.org/t/working-with-js-lib-promise/2865/3 "2021-01-25T12:05:11Z")

</div>

There’s no utility to the argument there, it’s there because of a “limitation” of Haxe’s type system. There’s no way (as far as I know) to define a generic argument that may be Void (meaning that you can’t make a function that may or may not take an argument depending on it’s generic type).

So in Haxe you can’t really use `Promise<Void>`, instead you could use `Promise<Dynamic>` and ignore the argument in the then function.

Regarding the side question, keep in mind that the `.then` method returns a new promise that resolves to whatever the function you pass to it evaluates to. So you can use then to map a promise into a different type or even to chain promises.

If you are targetting just javascript and using promises I recommend you take a look at [hx-jsasync](https://github.com/basro/hx-jsasync) (a lib I made and maintain)

---

_[View the full topic](https://community.haxe.org/t/working-with-js-lib-promise/2865)._
