Skip to content

[Seeking Help] Adding Typescript SupportΒ #212

@nickreese

Description

@nickreese

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:

  1. routes.ts
  2. externalHelpers.ts
  3. plugins.ts
  4. rollupPlugin.ts (look for ./server.js)
  5. 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:

  1. Update the Elder.js srcDir to match the outDir found in the tsconfig and update all of the files Elder.js reads looking for .js and allow it to accept .ts as well. This would be done in getConfigand let the user handle the compilation in their own tool chain. I planned on using this approach in alpha versions of Elder.js.

  2. 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. πŸ‘‚ πŸ‘‚ πŸ‘‚

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions