Widget Scaffolding for Typescript

0
Hey guys, I recently jumped into the custom widget creation scene, and I was able to find tutorials from Mendix about the yeoman scaffolding they provide. However, it appears the future lies in Typescript development for custom widgets, and I was wondering if anyone knew how I could start creating widgets using TS? I’ve edited a couple of widgets that were built using Typescript, but I have no idea as to how to create a base from which to develop further.   Any help/suggestions would be greatly appreciated. If I’m able to compile enough information I may just make my own little tutorial for future adventurers like myself.   Thanks! Austin
asked
4 answers
3

I think you should start from the boiler-plate generated by Yoeman and convert to typescript step-by-step.

  1. change js→ ts
  2. adjust gulpfile so you can compile ts files (maybe using webpack also, which allows you to import 3 rd library very easy). Remember to target to AMD
  3. install some types (dojo, mendix)
  4. come back to the code and remove old way of writing code in js by typescript.

 

That’s should be enough to start.

answered
3

Hi, I think there’s a generator by Jelte Lagendijk, you could have a look at that.

He mentioned it somewhere in the forum, but I can’t find the post again. I think it would be this one

https://github.com/JelteMX/generator-mendix-widget

regards, Fabian

answered
2

Hi Austin,

The future is indeed in typescript, but also in React which will be replacing dojo eventually. 
In fact some Mendix widgets are already using React right now see for example progress circle widget https://github.com/mendixlabs/progress-circle

 

I am sure that Mendix is preparing a scaffolding and tutorials for this new widget architecture. In the meantime a good starting point might be the progress circle widget I linked above.

-Andrej

answered
2

Mendix is transitioning to Typescript and thus a React boilerplate including a generator will be made available. The new Widgets Team is working on getting this ready for production. I can't give you a time-frame yet (I am not part of that team), but documentation & tools will be available when Mendix 8 comes out.

In the mean time you can use one of the examples on Github, there are plenty of them. The mentioned generator I created was build for ES6 JS, not Typescript.

answered