Setting up your Directories

Setting up your Directories

If you’re writing in plain JavaScript, it’s likely that you’re running your JavaScript directly, where your .js files in a src, lib, or dist directory, and then ran as desired.

If that’s the case, the files that you’ve written are going to used as inputs to TypeScript, and you’ll run the outputs it produces. During our JS to TS migration, we’ll need to separate our input files to prevent TypeScript from overwriting them. If your output files need to reside in a specific directory, then that will be your output directory.

You might also be running some intermediate steps on your JavaScript, such as bundling or using another transpiler like Babel. In this case, you might already have a folder structure like this set up.

From this point on, we’re going to assume that your directory is set up something like this:

projectRoot
├── src
│   ├── file1.js
│   └── file2.js
├── built
└── tsconfig.json

If you have a tests folder outside of your src directory, you might have one tsconfig.json in src, and one in tests as well.

doc_TypeScript
2016-10-04 19:25:34
Comments
Leave a Comment

Please login to continue.