-
Notifications
You must be signed in to change notification settings - Fork 184
RFC: Introduce TypeScript to monorepo #4087
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
Comments
I don't find Flow too frustrating to work with. In If we get stalled with product work and have a free sprint that we can't spend on other tech chores, I think this would be a good move forward. But things like: RPC removal, finding an alternative to Travis that doesn't bottleneck us and has a manual confirm feature (for terraform deploy later), and implementing the atomic command layer as the sole interface on top of hardware controller are all more urgent projects with more immediate benefits than Flow -> TS switch. I'm OK with the high commitment path (& option 2), the low commitment path is dangerous for the reasons you outlined, and option 1 where we leave things uncovered is scary. I just would rather have us work on other problems in the next couple months, this isn't a pressing one for me personally. |
Thanks for the thoughts @IanLondon!
Yeah, this question is a little hard to evaluate. All we have is anecdotes, but in every single anecdote I have (including two that are my own anecdotes) TypeScript is noticeably faster and more responsive.
I wonder if we have team consensus on this statement. If so, I think it is worth noting that switching to TS only becomes harder over time. If we don't switch now (e.g. before we add another four devs to the team), we might never. If our long-term goal is, in fact, to use TypeScript, we need to commit sooner rather than later.
Things make this "pressing" for me:
Of the other projects you listed, they're definitely all important, and in terms of having to rank stuff, they are more important. But aside from CI changes (which I don't think are fully scoped, so I personally wouldn't put them on this list as urgent) and RPC removal, I don't see how they are affected, because they don't really share developers or codebase. In terms of RPC removal, I would much rather implement the client side of the Sessions API in TypeScript rather than Flow. It makes me think of our proactive introduction of |
@mcous uhhh yikes that sounds bad! what do you mean?
Is there a difference particular to this project? |
As discussed in person:
I should've included more nuance in this. There's a couple things here:
The main difference is that it will be a relatively greenfield project within the app that will likely involve:
Given TypeScript's higher quality third-party library definitions (in this case, for |
We're moving forward with introducing TypeScript into our codebase in a considered manner that does not involve the monorepo at first. If and when we get to the monorepo, we'll have new tickets to track that work. Closing this ticket accordingly |
Uh oh!
There was an error while loading. Please reload this page.
overview
I know I've been talking about this (at varying levels of seriousness) for a while now, so I think it's time that I actually put all the things I've been saying into an RFC and see what happens.
I'm not trying to die on a hill or anything here, and choosing to keep Flow is a valid option here, but after a lot of time considering this, I think TypeScript is a better solution for our team than Flow. Switching is only ever going to get harder, so I want to (officially) start the conversation now
Please sound off in the comments if you've got any of your own for / against points. I'll start a thread in Slack for Q/A
TL;DR
Want to just see what it looks like before you read my essay below?
app-shell
to TS: 1fcf4bdresearch and reasoning
To research this switch, I’ve been spending time building several new apps/libraries in TS that are part of a JS monorepo of mine. This has allowed me to try out the following:
Element[]
toArray<Element>
interface
totype
for objectsimport {SomeType} from ‘module
rather thanimport type {...
&
works just fine for combining object types, so you don’t spreadReasons to switch to TypeScript
$PropertyType<MyDef, ‘key’>
MyDef[‘key’]
Reasons to keep Flow
Better support for ES proposals like optional chaining(To be released in TS 3.7)Next Steps
If we wanted to evaluate TypeScript in our monorepo, I think something like the following could work:
low commitment
To start, nothing we do should harm other projects, nor should it be difficult to fully reverse any changes.
app-shell
app
which can be shimmeddiscovery-client
app
(types) andapp-shell
(functionality)app-shell
, with types forapp
shimmedhigh commitment
If we choose to proceed to after the low-commitment changes, then we get into territory where reversing course (or even just not moving forward quickly enough) becomes more painful than getting to full TS.
cloc
, we have 67796 lines of JavaScript inopentrons/*/src
The text was updated successfully, but these errors were encountered: