Support for overloading a typed method signature based on parameter value.

Topics: Language Specification
Oct 2, 2012 at 1:03 AM

For a description of what I mean, let me link the SO post I made:

Maybe via some sort of pattern matching? Would be very useful for jQuery UI. 


Oct 2, 2012 at 1:50 AM

I think this was covered in Anders' video.  You can use a 'declaration' TS file that specifies the valid range of inputs.  He demonstrated a JQuery UI plugin.

Oct 2, 2012 at 5:23 AM

Did you see my Stack Overflow post? My question is a bit more complicated than just the basic JQuery UI Support in that sample.

Oct 4, 2012 at 5:47 AM

I see this has been answered on StackOverflow (namely you can't override the type of parameter X based on the value of a parameter Y).  We are aware of the use-cases this ability would have (especially me as I wrote the jQueryUI typing in the sample referred to :-) ), and have discussed it internally.  It's on our radar. (But no promises yet!).