Skip to content

Explore TypeScript Support #757

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

Closed
Weffe opened this issue Mar 12, 2019 · 9 comments · Fixed by #763
Closed

Explore TypeScript Support #757

Weffe opened this issue Mar 12, 2019 · 9 comments · Fixed by #763

Comments

@Weffe
Copy link

Weffe commented Mar 12, 2019

Intro

As of babel v7, TypeScript support has been added: https://babeljs.io/blog/2018/08/27/7.0.0#typescript-support-babel-preset-typescript

I personally love TypeScript and am sure others would love to see if TypeScript support could be added. As to my knowledge, babel does not do any type checking so that would be left to Visual Studio's intellisense and type checker. I think that works out fine because Visual Studio has pretty good TypeScript support and babel can be left to just transpile code.

What needs to change?

As of right now, the project will need to upgrade babel to v7. Proper configuration could be inspired from babel-preset-react-app.

Final Comments

I think TypeScript support would be an amazing feature to add to React.NET and would grant this project a wider audience. Especially those developers who prefer using TypeScript over JavaScript.

@Weffe
Copy link
Author

Weffe commented Mar 12, 2019

One thing I didn't think about was that Visual Studio already lets users transpile code on save from TypeScript to JavaScript. So this project should work just fine already with TypeScript -- which is being supported through a roundabout way (e.g. A developer hits save, Visual Studio transpiles from TS to JS and then React.NET now has JS files to work with). So maybe this might not be needed.

The one thing that could be a pro is that there wouldn't be 2 files per React Component (e.g. a TS and generated JS file). Instead, we could disable the Transpile on Save option in Visual Studio and have only just one TS file.

@dustinsoftware
Copy link
Member

Yeah, an update to Babel 7 would be very nice. We should make the change opt in, so that people can still use Babel 6 if they need to. If you’d like to do some exploratory work, that would be great, otherwise I’ll take a look at this soon :)

@Daniel15
Copy link
Member

Upgrading to Babel 7 should be doable, we'd just need to double check that all the JS engines support it. The MSIE engine might not like it, but perhaps nobody is actually using that engine any more? I'm not sure.

@dustinsoftware
Copy link
Member

dustinsoftware commented Mar 13, 2019 via email

@Weffe
Copy link
Author

Weffe commented Mar 13, 2019

Yeah, latest React version does not work properly in IE due to the use of Map and Set and I believe Symbol without polyfills. I agree with you guys that opt-in should be the default choice.

@Taritsyn
Copy link
Contributor

Yeah, latest React version does not work properly in IE due to the use of Map and Set and I believe Symbol without polyfills

@Weffe These features are only supported in the ChakraIeJsRt and ChakraEdgeJsRt modes (see details).

@atrauzzi
Copy link

Would love to see this! Also, I think avoiding any tooling that VS offers is wise as not everyone is necessarily using it and VS tends to add bad coupling that makes headless automation more difficult.

@dustinsoftware
Copy link
Member

dustinsoftware commented Mar 27, 2019 via email

@dustinsoftware
Copy link
Member

Typescript support is available now in 4.2.0-beta1. Please try it out and let me know how it goes. @atrauzzi @Weffe

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

Successfully merging a pull request may close this issue.

5 participants