Closed micahstubbs closed 2 years ago
@colinmegill I think you had mentioned that if we pursue this, we could start in a specific, more self contained part of the codebase. Was that the admin panel?
@patcon I'd also like to hear your thoughts generally about this proposal, as well as what part of the code base would be a good place to start.
This seems like a great idea! Never worked with typescript, but heard great things.
Will this make any attempt at merging admin+participation+report (esp handlebones stuff) any harder or easier, or can they mix and play nice and one area of code is unconcerned that others are in typescript? :)
I'd also like to try to identify and hard dependencies that we would need to start transpiling new .ts
or .tsx
TypeScript to JavaScript.
Do we need to make changes to the existing gulp config?
Do we need to migrate to webpack, in part or in whole?
Would it make sense to adopt @patcon's razzle PR #515 , to quickly enable TypeScript transpiliation? (Ideally these too things would be separate, but I could imagine how it could make sense to do them together.)
Not sure which intuitions to trust, but I can see it being easier for admin (since already really nice and reacty), but maybe bigger gains for participation (since it needs so much love). Leaning toward participation getting typescript attention first, just bc its the only experience of so many ppl, and improving that DX allows the user-facing bits to move more fearlessly and responsively :)
Again, no practical experiences with TS though, so take my hot-takes with grain of salt 😁
Will this make any attempt at merging admin+participation+report (esp handlebones stuff) any harder or easier, or can they mix and play nice and one area of code is unconcerned that others are in typescript? :)
Easier if all are typed.
The same if not, as you can just type the interactions with untyped code as any
to start with.
Do we need to make changes to the existing gulp config? Do we need to migrate to webpack, in part or in whole?
My sense is that, yeah, build system (gulp=>webpack) might need attention before moving to TS. Stuck on a few diff versions of node until then, it seems
makes sense. I'll checkout a branch and try to get TypeScript tooling setup.
@patcon if you are interested in doing the same experiment, I am happy to review and merge your TS config if you get it working before I do.
Thanks a ton @micahstubbs and @patcon! An aside, for performance reasons, client-participation
is a separate bundle intentionally. client-report
and client-admin
will be merged, and client-report
modernized along the way.
There are a lot of dead routes on the server, and a number of routes that could be:
.catch
.p.
https://github.com/compdemocracy/polis/blob/dev/server/src/server.js#L7670
okay, I've checked out a branch to add typescript to the server
directory sub-project
WIP PR here https://github.com/compdemocracy/polis/pull/961/files
Do we want to close this? Or we could add a checklist to the body of the initial comment to track all the steps for typescript conversion?
EDIT: And if closing, do we spin out tasks from @colinmegill's comment above: https://github.com/compdemocracy/polis/issues/960#issuecomment-820028778
Closing as we've made progress. As a next discussion topic, we would want to create a list of high priority types to add to https://github.com/compdemocracy/polis/blob/dev/server/src/d.ts in our next pass at typing
Problem: Reliability could be better. Deployments break for hard to debug reasons. Interfaces are less documented than we'd like, and sometimes unclear to new contributors.
Suggested solution: Adopt TypeScript gradually for the current JavaScript codebase.
Additional context: https://www.typescriptlang.org/