Reputation: 701
I've recently started working on a new project at work which has been utilizing React and JavaScript.
As someone who mainly used TypeScript in previous projects I've been struggling a bit with how loose everything is.
If I were able to, I would just convert the whole project to TypeScript however some of my coworkers aren't familiar with it.
My question is, lets say for example, I needed to add a new component somewhere on the page, would it work if I added TypeScript to the project with npm and had only one file as .tsx
? Of course when building the project for production I would run TSC
to compile it back into vanilla JS.
Also thought I should just point out I’m not looking to convert the whole project to TypeScript, just a few here and there.
Thanks!
Upvotes: 0
Views: 2567
Reputation: 1017
Set up your project as if you were going to convert everything to typescript, make sure you have allowJs
and checkJs
set to true in your tsconfig file, make sure all variations of TS strict mode are off, then convert as many or as few (or even none) js files to ts.
Upvotes: 1