What's the difference between `tsc --build --clean` vs. `rm -rf *.js`?

Viewed 3506

I have a quick question on the tsc command being used with the arguments --build --clean, which I understand is used for cleaning /wiping off the .js files generated earlier by the Transpiler (tsc).

What is the speciality or significance of this command? If at all I need to remove all the .js files, I can easily accomplish it through rm -rf *.js or del *.js in the directory.

Can someone educate me on the missing pieces if any?

2 Answers

The difference is that rm will happily delete any files, even if they weren't generated by transpiling TypeScript.

The difference is --clean is useless in general. If you have ever renamed, moved, or deleted a source file, clean will not clean up the transpiled output.

Related