TypeScript for Max

Thorsten Ørts's icon

I have taken a stab at getting TypeScript to compile to JavaScript for use in Max.

From Wikipedia: "TypeScript is a free and open-source programming language developed and maintained by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language."

With the TypeScript plug-in for Sublime Text you get features like code completion and some refactoring functionality.

This has not been thoroughly tested and has plenty of TODO's in the definition files, but the grunt work of writing the definitions has been done.

orange_glass's icon

@THORSTEN Thanks so much for making this, it is really helpful, I'm wanting to use typescript with max as well and have found this an inspiration. You mention in your github "The Max JS documentation has been included as JSDoc" , did you make the JSDoc yourself or are they available somewhere? I'm in the process of building a TS based abstraction of the LOM.

Thorsten Ørts's icon

Hi ORANGE_GLASS I'm happy that you find my work useful :)
I created the JSDoc manually from the online Cycling '74 documentation. If you want to extract it from TypeScript for Max for your own use, you're more than welcome as far as I'm concerned, but obviously take into account that Cycling '74 still has the copyright on it.

Andrew's icon

Pleased to see TS for Max, seems like a much better way to write JS. Thanks for doing this.

do.while's icon

awesome ! thank you

Zack's icon

@THORSTEN ØRTS This is great, thanks!
@ORANGE_GLASS Just wondering, did you ever finish that TS binding of the LOM?

orange_glass's icon

It's not far off, I'm planning to upload a beta to github soon.

Zack's icon

Nice, I'd love to be informed about that! What's your github account?

I just spent the day configuring all of this to work with a library folder which will copy the TS library files into all of the plugin directories that use the library on compilation. This is necessary because it seems like you can only reference other javascript libraries from the exact same directory. So now I've got it copying the .ts and compiled .js files to the plugin folders where the js scripts are. That way I can also get type information from the library .ts file for the max script .ts file as well. Too bad they don't let you require libraries in different folders though.