Extension methods

Topics: Language Specification
Oct 2, 2012 at 3:21 PM
Edited Oct 2, 2012 at 3: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.

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