Skip to content
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

Typescript version? #51

Open
amritk opened this issue Jun 22, 2021 · 4 comments
Open

Typescript version? #51

amritk opened this issue Jun 22, 2021 · 4 comments

Comments

@amritk
Copy link

amritk commented Jun 22, 2021

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?

@dfagan2
Copy link
Contributor

dfagan2 commented Jun 23, 2021

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.

@amritk
Copy link
Author

amritk commented Jun 23, 2021

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.

@dfagan2
Copy link
Contributor

dfagan2 commented Jun 23, 2021

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.

@amritk
Copy link
Author

amritk commented Jun 23, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants