Open amritk opened 3 years ago
Not opposed to it, but we historically have not opted to pick Typescript for net-new projects that would benefit from a React Gantry bootstrapping. So the return on investment is debatable. How long would you estimate that translation would take?
Depending on your answer, I might recommend that we tackle that as part of a project - deploying Gantry and tweaking on the fly - and then work to retroactively translate that back into Gantry and Robits. That way, we let the project need and billable time drive the effort.
Hey David I won't get into the benefits of typescript here (although I will at some point, somewhere, I believe we should be typescript by default and opt into JavaScript situationally). I'm still new to React so I'm not confident in this accuracy but I would estimate 2-8 hours depending on any issues that would arise. Just changing the extensions from js
to ts
(with a bit of config) should start providing some type safety instantly. I know React was traditionally used with flow and only a few years ago made the switch to typescript, so support isn't as great as the other frameworks but it believe it is mature enough at this point.
That is perfectly fine, I just wanted to bring this point up as I think part of the reason typescript isn't chosen is due to it not being available in the Gantry bootstrap.
I think part of the reason typescript isn't chosen is due to it not being available in the Gantry bootstrap.
...the reasoning is deeper, and actually predates Gantry's existence, so it's not that. And you're right, this is not the forum for that debate.
That estimate isn't bad, so definitely something we could entertain. Of the two helpers we have, Robits might be the better fit for this effort though, because it involves a lot more code (bigger impact), and I know Typescript components can still be leveraged inside vanilla JS projects.
Yes shared components can definitely use typescript as they can be compiled into JS before sharing, in fact a lot of popular NPM projects work this way. So that should be a go!
I was thinking for the base project though, that's why I opened the issue with Gantry. It would be a lot easier for someone to simply clone the repo and have typescript support enabled out of the box, as opposed to copying over the config files one by one from robits. Although I'm not sure how we would implement it. Off the top of my head it would need to be a separate branch or fork.
Alternatively we could just switch to typescript by default and projects can just continue to use JS
if they please. It would add some type safety for everyone and each project can decide how much or little typescript they would like to use. The only downside would be some additional compile time.
Should we create a typescript version in case a project wants to use typescript? It would make it much easier to hit the ground running as opposed to converting this project into TS. Thoughts?