jdonaldson / promhx

A promise and functional reactive programming library for Haxe
MIT License
145 stars 24 forks source link

`whenAll` should return `Promise<Array<T>>` #19

Closed andyli closed 10 years ago

andyli commented 10 years ago

According to the declaration:

public static function whenAll<T>(itb : Iterable<Promise<T>>) : Promise<Array<T>>;

It should return a Promise<Array<T>>, but in fact a Promise<Array<Dynamic>> is returned.

import promhx.*;
class Test {
    static function main():Void {
        var p0 = new Promise<Int>();
        var p1 = new Promise<Int>();
        $type(Promise.whenAll([p0, p1])); //Warning : promhx.Promise<Array<Dynamic>>

        Promise.whenAll([p0, p1])
            .then(function(v:Array<Int>) trace(v)); //v : Array<Int> -> Void should be Array<Dynamic> -> Void
    }
}
jdonaldson commented 10 years ago

are you on haxelib version or github? The latest repo version has the behavior you want, and I'd recommend using that. I'm changing up some of the api a little bit, and am writing some documentation.... should have everything ready soon.

andyli commented 10 years ago

Oh, I was using the haxelib version but looking at the source at github. Switched to github version and it worked as expected now. Thanks!