Hi there,
I wanted to give some hints how to migrate larger codebases to TS:
- Since the new dojo build chain, or more precise the google closure compiler supports the ES6, you can use a tool called ‘lebab’. It converts old code to new code,ie: :
npm install -g jscodeshift
lebab --replace ./Context_UI.js --transform arrow // notice that the ‘arrow’ transform breaks the dojo build since it doesn’t support the arrow on 'define’
See mee transform options here : https://github.com/lebab/lebab#safe-transforms
- there is another tool which converts AMD to CJS modules:
npm install jscodeshift
jscodeshift -t node_modules/5to6-codemod/transforms/amd.js mymodule
In both cases you still need to make some fine tuning
- Never got this working properly but you can instruct the TS compiler to load AMD modules, as outlined here : ht://blogs.esri.com/esri/arcgis/2017/10/27/creating-a-custom-tile-layer-with-typescript/ or here ht://www.codebelt.com/typescript/typescript-amd-with-requirejs-tutorial/
That’s it for the start,
regards, Guenter