M
M
msdos-x862018-02-22 19:05:03
JavaScript
msdos-x86, 2018-02-22 19:05:03

How to structure files in TypeScript?

If I understand correctly, when compiling, all .ts files create files with the same name, but with the .js extension, and all these .js files can be thrown into the dist folder after compilation and you can specify this in tsconfig.json, as it is written in the documentation . But what if storing all .js files in one folder is not an option? What if the files must be located in different folders. Of course, you can simply set it up so that there is a .js file right next to the .ts file, but it looks somehow strange. Are there other ways?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2018-02-22
@msdos-x86

If we are talking about nodejs (according to the tags), then you just need to run it like this: ts-node ./index.ts( ts-node ), you will not even see the compiled files.
If, more than expected, we are talking about the frontend, then the bundler (most often webpack) is involved in the assembly, again, the intermediate compiled files are not visible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question