I am working on a React Project and have a bunch of tsx files that I want to convert as use as javascript for my project. How should I do that?
I am working on a React Project and have a bunch of tsx files that I want to convert as use as javascript for my project. How should I do that
You can use the typescript compiler e.g.
npx -p typescript tsc somefile.tsx
While the web is full of guide on how to translate React Javascript into Typescript, I don't found any reverse guide (so strange...). Anyway, I had same problem some time ago and I found useful get one of those guide JS => TS for React and read backwards. For example, I used this guide. When he said "JavaScript looks like that so you can translate this into Typescript in this way..." I did the contrary (and it worked!). Of course you can skip all the dependencies part. Try and let us know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With