Typescript? #426
Replies: 8 comments
-
I think it adds a bit of overhead and makes development slower, I'm not sure about the benefits for this project. But of course if the trade is alright it could result in better and safer code. |
Beta Was this translation helpful? Give feedback.
-
The benefits of type safety done right are extremely profitable. Less errors and much more confident changes regarding types. No half way or outdated PropTypes definitions. Also most popular libraries have types definitions, so the development experiences gets nicer overall. Could see in this case of JS vs adopting TS as keep doing JS to code "quick-and-dirty" or gradually adopt TS to see great benefits on the long run. Obviously quick-and-dirty is an oxymoron when talking about code, unless you mean to discard the code or not reuse it after making it. Meaning that code written quickly and easily can prove to slow you down a lot in the short and long term. But I'm kind of exaggerating a bit since JS is not a that bad :D Anyway, I agree that adopting TS would make overhead, and if it's the case that no other active developers know TS or are not very into learning it to keep collaborating to the project, maybe not worth it. In my experience, the first time I tried making a side TS project alone by myself, I got really frustrated and could not finish it. I go stuck and it sucked. Currently I got to understand it mostly and I love it. Having said that, we are not alone here. So, in case we could at least consider TS for this project, there could be ways to mitigate the overhead and frustration for others:
|
Beta Was this translation helpful? Give feedback.
-
Did a little test in elmaonline-web project, converting a single file to TS import Layout from 'components/Layout';
import { battleStatus } from 'utils/battle';
Cannot find module 'components/Layout' or its corresponding type declarations.ts(2307) Tried updating the
So for that project I thought of possible fixes for this:
|
Beta Was this translation helpful? Give feedback.
-
i'm not against typescript but don't have a strong opinion either way at this point. |
Beta Was this translation helpful? Give feedback.
-
I don't really see any major benefits in typescript personally. There's strong typing which is fine but that's basically it which then adds complexity and an extra transpile layer. Other benefits that are usually mentioned is basically extra linting which should be possible without typescript. |
Beta Was this translation helpful? Give feedback.
-
Well in that case if people are not interested in it, and the fact that not everyone will want to invest on it, then it won't happen. But for me that's the only downside for using typescript in this project. Type safety it's not just fine :/ it is great. It gives so much better But again, the development team skills or language knowledge and preferences are always a strong argument to consider. Same as for including any dependency in a project. So that's that. |
Beta Was this translation helpful? Give feedback.
-
Having worked on a typescript project this year, I've now seen the light. It's probably unlikely we can get to full strict mode any time soon, but getting the autocomplete from libraries and converting the most used components/functions would be a nice help in future work. For current contributers: are you familiar with typescript and do you have any thoughts on this? |
Beta Was this translation helpful? Give feedback.
-
I haven't seen the light yet but my employer uses TS - I haven't really coded much frontend recently but I think consensus is pro TypeScript among frontend developers. Maybe it's good in healthy code base and when done correct? To my eye it decreases the code readability. Simplicity is a virtue in programming. GPT recommends in large codebases with several developers. |
Beta Was this translation helpful? Give feedback.
-
Any thoughts on adding typescript to the project? Could it be a good thing?
Add typescript to a create-react-app project:
https://create-react-app.dev/docs/adding-typescript/
The setups seems very simple, not sure if there would be unexpected complications after it.
The big disadvantage that I can think of (assuming no big technical difficulties or drawbacks) would be that some people might not have any experience with typescript, and would definitely complex the development for them. Although we can always help those people and everyone wins :>
The advantages are huge (read on https://www.typescriptlang.org/). A key thing would be the possibility of Gradual Adoption:
🐻
Beta Was this translation helpful? Give feedback.
All reactions