-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Hey All! I'm not a TS expert, yet many people in the community are asking for TS support. That said, I'd love the help from someone who knows TS and common TS toolchains to help us get native TS support in Elder.js.
Hurdles Blocking TS Support
At a high level the main hurdle to implementing TS for Elder.js really comes down to:
The fact that there are several files that read the system expects .js files in specific places. These files include:
routes.tsexternalHelpers.tsplugins.tsrollupPlugin.ts(look for./server.js)- I'm sure there are more... (I'll update this list with edits)
When Should Elder.js Compile TS?
Accepting TS files in the above listed code isn't a hard problem to solve, there was a partial attempt to get these playing nicely which you can see on this PR (#170)... the main problem comes down to when we compile TS and run that code.
The way I understand it there are two options:
-
Update the Elder.js
srcDirto match theoutDirfound in thetsconfigand update all of the files Elder.js reads looking for.jsand allow it to accept.tsas well. This would be done ingetConfigand let the user handle the compilation in their own tool chain. I planned on using this approach in alpha versions of Elder.js. -
Another suggestion from @orta that is on the TS team mentioned that we could just use an esbuild background process to transpile TS on the fly and just run the output as if it was a JS file.
The main reason neither of these have been implemented is that I just don't understand TS tooling well enough to make a decision because I don't know the pros/cons of each.
If anyone has strong opinions or would like to offer support, I'm all ears. π π π