Reputation: 1121
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?
Upvotes: 4
Views: 24259
Reputation: 11156
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.
Upvotes: 4
Reputation: 276269
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
Upvotes: 8