Your assumption is absolutely correct - build artefacts and outputs shouldn't be added to your repository. The main reason for this is that it's easy to end up in a situation where the source .ts
file has changed but the compiled .js
file differs because it's not been committed at the same time.
You also add complexity to your pull-requests/merge reviews, as there will be a large amount of generated code that isn't really part of the review but is in the changeset.
Finally, merging changes becomes a bit of a pain, because you need to recompile the .js
files for every merge you do.
If you only use .ts
files in your source directory, you can add /**/*.js
to your .gitignore
to prevent files from being added accidentally.