Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing routes in typescript #167

Open
asterius1 opened this issue May 5, 2021 · 2 comments · May be fixed by #170
Open

Writing routes in typescript #167

asterius1 opened this issue May 5, 2021 · 2 comments · May be fixed by #170
Labels
enhancement New feature or request

Comments

@asterius1
Copy link

I usually write all my projects in typescript and indeed elderjs has nice support for typescipt in most cases, but I can't make it work to write elderjs routes in typescript.
Changing routes.js to routes.ts makes it so elderjs doesn't see this route file.

From what i've seen in elderjs code all references to finding routes have hardcoded *.js extensions without mention of *.ts option.

Does it mean there is no way to write elderjs project in 100% typescript?

@nickreese
Copy link
Contributor

That does sound right. I wasn’t a huge TS user when I wrote Elder.js and all of my projects use JS currently.

For a while we checked the dist folder defined in the tsconfig when files weren’t found but that support got dropped pre 1.0 IIRC.

I’d love to have support for this but can’t commit to developing it myself. This should be a relatively straight forward PR though. Simply check the tsconfig for the distdir and update the appropriate fields in getConfig.ts.

Happy to review a PR for this if you or someone else wants to tackle it.

@nickreese
Copy link
Contributor

Today I was chatting with @orta from the TS team about how to implement this.

He recommended looking into using esbuild in memory transpiling and just evaluating the resulting code whenever a ts file is imported.

@eight04 eight04 added the enhancement New feature or request label Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants