I'm pretty surprised this isn't in the docs that I could find - but is there any way to just tell tsc
to run against all files in a directory and its children without going through a whole tsconfig.json
setup?
Tsc stands for `TypeScript compiler` and is a simple tool included in Typescript itself, allowing you to compile any ts files into js.
Open a terminal and run tsc -w , it'll compile any . ts file in src directory into .
Running tsc locally will compile the closest project defined by a tsconfig. json , you can compile a set of TypeScript files by passing in a glob of files you want.
Install the TypeScript compiler# Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript compiler either globally or in your workspace to transpile TypeScript source code to JavaScript ( tsc HelloWorld.
Not that I know of. Using tsc
from the command line without a tsconfig.json
requires that you specify each file individually, like so:
tsc MyFile1.ts MyFile2.ts MyFile3.ts
However, it looks like you can simply create an empty tsconfig.json
(i.e. just {}
) at the root of your TypeScript directory and it will do what you want. From https://github.com/Microsoft/TypeScript/wiki/tsconfig.json:
If no
"files"
property is present in atsconfig.json
, the compiler defaults to including all TypeScript (*.ts or *.tsx) files in the containing directory and subdirectories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With