Main Differences
Purpose:
Impact on Output Structure:
Impact on File Selection for Compilation:
rootDir: Does not affect the selection of files for compilation.
baseUrl: Only affects non-relative imports.(not files)
Conclusion
Thus, rootDir and baseUrl serve different purposes in TypeScript configuration. rootDir helps organize the structure of source and output files, while baseUrl simplifies working with paths when importing modules. Proper use of these parameters can significantly improve the organization of your project and simplify working with code."