index.ts
or index.js
):index.ts
file rather than from multiple module files.index.ts
), all imports from a module are centralized in one place.
This means if the file structure changes (e.g., moving or renaming a module), you only need to update the paths in the barrel file, not in every file that imports from that module.index.ts
, and the rest of your code remains untouched.