This project is read-only.

0.9.5 Beta method overload bug?

Topics: General
Nov 21, 2013 at 12:58 AM
Consider the following
    private static RgbaHexRegExp: RegExp = /^([a-f\d])([a-f\d])([a-f\d])([a-f\d])$/i;
    hex = hex.replace(Color.RgbaHexRegExp, (m, a, r, g, b) => {
        return r + r + g + g + b + b + a + a;
The overload resolution fails to find the appropriate overload. However F12ing the method takes me to the appropriate overload in the definition file. I've also tried typing all parameters to no avail
Nov 21, 2013 at 1:18 AM
Edited Nov 21, 2013 at 1:19 AM
This is by design. 'replace' can invoke the function with as few as 1 arguments, so the function you provide can have at most one required parameter. The function signature should be (m, a?, r?, g?, b?) => { ... } instead.
Nov 21, 2013 at 1:19 AM
Interesting. I wasn't aware of that issue. Thanks. Sorry for posting in the wrong location. I just realized it and tried to delete but you replied faster than i could :)
Nov 21, 2013 at 1:22 AM
This sort of thing is totally fine in the General forum, actually. Thanks for trying out 0.9.5!
Nov 21, 2013 at 1:29 AM
Wait a minute...If i read you correctly then we can have params style declarations? When was this added?
(requiredArg: string, ...args: any[]) => string)
is this the proper definition? (with the ...)