Extension methods

Topics: Language Specification
Oct 2, 2012 at 2:21 PM
Edited Oct 2, 2012 at 2:30 PM

In Javascript you can add functions and other types of members to objects by adding them to the prototype.

The adding of functions (even accessor properties) to objects could be simplified in TypeScript with a language extension similar to Extension methods in C#. Pro is that you don't need to write weak code to extend types.

Extension methods could be stored in modules and available as they are imported.

Oct 4, 2012 at 10:47 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.