I have a project whose file and folder structure is as follows
app
core
|--Cumulus
|--|--Cumulu.ts
|--Dimensions
|--|--Dimension.ts
|--Galaxies
|--|--Galaxy.ts
|--SolarSystems
|--|--SolarSystem.ts
|--Universes
|--|--Universe.ts
c137.ts
package.json
I would like to know how I can transcompile all the files .ts
without having to go through each one tsc file.ts
, tsc file2.ts
, tsc file3.ts
, the expected would be something like this:
app
core
|--Cumulus
|--|--Cumulu.js // javascript
|--|--Cumulu.ts
|--Dimensions
|--|--Universe.js // javascript
|--|--Universe.ts
|--Galaxies
|--|--Galaxy.js // javascript
|--|--Galaxy.ts
|--SolarSystems
|--|--SolarSystem.js // javascript
|--|--SolarSystem.ts
|--Universes
|--|--Universe.js // javascript
|--|--Universe.ts
c137.js // javascript
c137.ts
package.json
If you're looking to compile all the files
.ts
in a project ( or directory ), you only need to do two things:1.- Create a file
tsconfig.json
where you can set the options for thecompiler
. Open a terminal, go to the root directory of your project and run:2.- Finally, it only remains to execute the
compiler
on the directoryMore info: Compiler Options
I managed to do what I wanted by creating a file
tsconfig.ts
, adding this to it and runningtsc
in the console