CRA now has support for TypeScript. We should update the templates to use it.
Do you want to have one template with JS, one with TS? Or just the latter one? Or the former one but with README explaining how to enable it :D
TS only.
Why not have this behind a flag at creation? Not everyone wants to use Typescript.
@lflpowell Simply because we have limited resources. We simply cannot support every combination of client-side technologies, so we have to choose which combinations we think will provide the most value.
This is great to see! I was just looking to open an issue about supporting TypeScript with create-react-app@v2+.
Digging around open issues about TypeScript, it seems like in #4375 there was an issue where the tsconfig.json was causing Visual Studio to generate JS files.
There is one big gotcha with using a TS CRA in the ClientApp folder, which is that VS2017 has issues with tsconfig.json files that live in a sub directory rather than the project root.
A big part of that is it has trouble resolving that the tsconfig.json and often thinks there is no tsconfig.json file. So it tries to use a default configuration, which includes compiling TS files and producing JS files. This gets messy and is a headache to navigate/manage.
The way we worked around this is by opening ClientApp in VSCode and only editing the ClientApp in VSCode. That way the tsconfig.json file is in the root of the project, and VSCode picks it up fine. I suspect you could do something similar with VS2017+VS2017, rather than VS2017+VSCode, but I haven't tried that myself.
I don't know if this was a random case of things not working properly but @AndyCJ has a pretty good write up of his exploration with why this might be the case here and how to reproduce the issue here.
I feel this might be something to look out for when upgrading create-react-app to v2+ and integrating TypeScript with it.
@lflpowell Simply because we have limited resources. We simply cannot support every combination of client-side technologies, so we have to choose which combinations we think will provide the most value.
The most value to Microsoft or the most value to the users? In the react ecosystem which is used most often? JS or TS? Which one has more documented examples, JS or TS? I understand not wanting to support a bunch of different ways to use client-side libraries but I think it makes the most sense to use what is most widely used by the user base.
Moving this to Backlog as we have no capacity to do this in the near future.
At this point we have no plans to do this, so closing.
Are you taking contributions for using typescript version of template (converting existing JS version) using create react app? I would like to work on this.
@ChiragRupani Not at this time. We've decided to stick with the JS version for now. However, we hope in the future (.NET 5) to turn the SPA templates over to the community so that the various JS communities (React, Angular, Vue, etc.) can control what options they prefer to provide.
Most helpful comment
TS only.