-
Notifications
You must be signed in to change notification settings - Fork 48
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
Start using TypeScript #871
Comments
big flaming +1 |
One salient difference between this project and Auspice is that Auspice has a bundler/transpiler layer whereas this repo runs directly through nodejs. In other words there's no "build stage" for the server. Is this issue proposing using |
Previously there wasn't, but now there is with the addition of Next.js, at least based on my understanding in #810 (comment). I just noticed 2eedca4 already introduced traces of TypeScript: a tsconfig file and 2 TSX files. So it looks like it's already used behind the scenes by Next.js - I think we just need to make our own configurations to use it elsewhere. |
Not quite -- the frontend still has a build stage (edit: in production mode only, in dev mode it's compiled on-demand as pages are requested), but that's directly analogous to the previous set up where gatsby also had a build stage. With nextjs this now uses TS, and since it's no longer siloed into (Further complicating the layers involved here, nextjs running from within our server actually runs in its own (nodejs?) process and I suspect it's able to use TS files somehow, but AFAICS that doesn't help us introduce TS into our server. Lots of layers.) |
I see – I forgot that there is still a big distinction between frontend and server even though they share the same package.json now. Yeah it would be worth trying a few options and comparing the complexities here - I haven't used any of them before.
It's still under |
FWIW, $JOB[-1] had a monorepo with an Express-based backend app / API server and a Svelte-based front-end. They shared a package.json (IIRC anyway) and there wasn't a perceptively painful build step for the backend during normal development, only when we built a specific artifact for deployment (to AWS, as a "lambda-lith"). Happy to mock up a small demo repo with what that looked like if folks would like to kick the tires. (Note: this is not a proposal to convert the front-end to Svelte!) |
Upon re-reading this today I realise there may be two separate conversations going on in this thread (and that may be on me!) Adding TS to the (nodejs) frontend The frontend ( Adding TS to the server This is what my comments in previous messages were focused on. It would (probably) introduce an extra layer, but as long as we picked well this wouldn't be too burdensome. Having worked in the server a bunch recently I would strongly support gradual introduction of TS. As part of this we could also move the resource indexer to TS in the same fashion. The above paints these as separate siloed projects, which is essentially true at the moment. If we moved to SSR and shared information between our server and frontend pages (e.g. as I did in this prototype, and Tom's done elsewhere as well) then it's a little more complicated as we'd want to share type definitions between the silos. |
I'd urge doing that as a deliberate two-step (or three-step?) process: get everything using Typescript, get a good start on adding typing everywhere, and only then worry about refactoring out a set of common shared types. |
Great to split these out - thanks for making the distinction. I've updated the issue description to reflect this. |
It would be nice to allow usage of TypeScript files in this project similar to how it was introduced in Auspice: nextstrain/auspice#1450
This would affect the way the site is built, but given the benefits of TypeScript, I think we're all fine with the added complexity (mentioned briefly in https://github.com/nextstrain/private/issues/88)
Tasks
static-site/
) through Next.js (more of an unintentional side effect): 2eedca4src/
) and resource indexer (resourceIndexer/
)Notes:
.ts
/.tsx
files with curated options intsconfig.json
. Actual usage of TypeScript is expected to happen incrementally over time.The text was updated successfully, but these errors were encountered: