You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble chaining functions/promises using the Bluebird extern. I believe Haxe's type inference engine is failing to deduce the return type of a fulfilledHandler that comes after a fulfilledHandler with a return type of Void.
Here's a small test case that exhibits the problem:
I think I can work around the issue by returning "null" in one function and accepting a dummy arg in the next, but this is awkward for chaining existing functions together, and problematic for making use of externs or libs.
The text was updated successfully, but these errors were encountered:
Can you please make a PR with your test in https://github.com/clemos/haxe-js-kit/tree/master/test/buddy/src ?
It's indeed always difficult to keep JS's flexibility while typing stuff as much as possible, especially with method signatures / optional arguments.
Regarding the extern, you try to change T -> Tx signatures to ?T -> Tx (or ?T -> ?Tx ?); otherwise, you'll probably need to add more @:overload with Void -> Tx and/or Void -> Void ?
Yes, I'm finding it's quite difficult. If I use something simple like the "Promise.hx" stub contained in the Sequelize dir, that makes use of Dynamic, it works pretty well but loses type safety.
I had no idea you could have optional type parameters! That's amazing! 😄
I'm still learning Haxe, so apologies if I'm just doing something silly and not understanding how to enforce the types.
I'm having trouble chaining functions/promises using the Bluebird extern. I believe Haxe's type inference engine is failing to deduce the return type of a fulfilledHandler that comes after a fulfilledHandler with a return type of Void.
Here's a small test case that exhibits the problem:
I think I can work around the issue by returning "null" in one function and accepting a dummy arg in the next, but this is awkward for chaining existing functions together, and problematic for making use of externs or libs.
The text was updated successfully, but these errors were encountered: