-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
I tried asking around and didn't find answers about this behavior other than the flow-typed rxjs typings that describe this defect.
As of 0.31, variadic functions' type signatures aren't selected correctly and the earliest entries will end up being used. This meaning that if I have a typing for the same function for two or three arguments, if the two-arg definition is above the three-arg definition, it will be picked even when using three.
It seems like you can get around this by reversing your definition ordering, but I'm guessing that probably opens a whole 'nother can of worms (if not, it's still not great).
Edit2: Oh, yes, looks like I was really wrong about this, it just matches on the first one The tooltip is wrong, it really does seem to match the correct signature but only if the ordering is reverse from highest number of args going down:
Is this to be expected and solvable in another way, or is this actually a defect?
Repo with more details: https://github.com/justinwoo/flow-type-select-ordering