Configure Netbeans With Typescript

Typescript is to Javascript what LESS is to CSS. It is a superset that compiles down into the other language, and allows you to create a larger, more manageable codebase. For more information, you can visit the Typescript website or watch the excellent video below from youtube.

Introduction to Typescript

Steps

Install NodeJS if you haven't got it already.

Go to the latest release page of the Netbeans plugin and download the .nbm file

wget https://github.com/Everlaw/nbts/releases/download/v2.0.5.1/netbeanstypescript.nbm

Open Netbeans and click Tools > Plugins. Then go to the Downloaded tab and click Add Plugins.

Select the .nbm file you just downloaded.

Now make sure the plugin is selected and click install. Keep clicking continue and accept the warning message stating that the plugin is not signed.

Configure Typescript Files to Compile On Save

You can manually compile your typescript files to javascript, but it's probably much easier to just have Netbeans do this for you whenever you save.

Right-click your project and click on Properties.

Click on the Typescript option below Javascript Frameworks and then click Compile on Save. Ignore the message to edit the tsconfig file as there isn't one by default and performing this step has the desired effect.

Refer here if you wish to create your own tsconfig file and configure various aspects of Typescript.

Conclusion

You have now installed support for Typescript in Netbeans. You can now create Typescript (.ts). For an extremely basic example, you can create a hello_world.ts file with the following contents:

var x: number = 4;  
var y: string = x  

... and you should get a Typescript error message like below.

References

Author

Programster

Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus