It is possible to use TypeScript when writing code for components and services inside Web Package projects,
here are the steps to follow
- Install https://github.com/palantir/eclipse-typescript TypeScript plugin into Servoy Developer
- In Solution Explorer, under "All web package projects", right-click the project you want to have TypeScript,
and select "Configure" then "Enable TypeScript Builder"
- Change the extension of all your "js" files to "ts"
- Make sure your "ts" files are transpiled during project build, go to "Window", "Preferences", "TypeScript", "Compiler" and
enable "Compile all TypeScript files on build"
Include in your "ts" files the type definitons for Angularjs; you can download this from angular typings file, and include it in you project, then add the
following line in your "ts" file, at the top :
/// <reference path="../angularjs/angular.d.ts" />
make sure you set the correct path to the type definiton file
- If you are using other libraries, like jquery, you can try to find an already created type definition here https://github.com/DefinitelyTyped/DefinitelyTyped that you can include just like for Angularjs in the previous step