Feature Request: Language extensions

Topics: Language Specification
Oct 4, 2012 at 10:31 AM
Edited Oct 4, 2012 at 10:32 AM

Since, typescript is completely written in javscript, it would not be too difficult to make some sort of extension system to the language is it? 

For instance: Keep typescript pure with a the current build. But make it possible for developers to add language extensions to they can get coffeescript like features.

I like typescript because it's a very thin layer with a single purpose of making javascript more typed and safer to produce large scale applications and better tools for refactoring.

I love coffeescript because it fixes some of the crazy crap that JS does as a language. And it allows for less physical typings beause of the shortcuts for 'this' foreach etc. splats and what nots.

How cool would it be, if i as a developer, can add an extension that allows me to extend the language in such a way that i can my own coffeescript like features to the language? 

What i am refering to is hooks in the scanner,parser and compiler.

I could then compile my code in such a way like: tsc bla.js -extend myextensions.js, such a solution will also prevent the language from getting polluted.

Oct 4, 2012 at 9:39 PM

+1, I really love this idea!

mr_much_win wrote:

I could then compile my code in such a way like: tsc bla.js -extend myextensions.js, such a solution will also prevent the language from getting polluted.

 I think we should have an extension registry in order to allow those features. In addition, TypeScript could add 'stable' extensions in regular time intervals into the main source code.

Oct 26, 2012 at 12:54 PM

+1, I need this too!

Oct 29, 2012 at 10:08 PM

I think you should figure out a way to make sweet js work with TypeScript: http://sweetjs.org/