Replies: 1 comment
-
The main reason behind the re-export is a technical limitation of some plugins. As you found out the index.ts is just a mechanism for building the overall alphatab.ts. I could rename the index.ts to something different to avoid that imports are generated by VS Code. Here some references around this topic: #682 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some of the folders in
src
have anindex.ts
file that re-exports most of the files in that folder. A common pattern.However, after some looking around I found that very few source files (mainly tests) use the imports from these index files. Almost all imports use the full path. Additionally, when comparing the listed re-exports and the files, there are some files that are not re-exported (perhaps due to human error when maintaining them?).
Advantages of having
index.ts
: Imports statements across the project can use a shorter syntaximport { a, b, c } from ...
.Disadvantages: The index files need to be manually updated (unless there are tools for this that I don't know of). In their current state, they are more of an annoyance due to increasing the total file count.
It would be nice to see the index files serve their purpose and be used more, or have them removed to free up space since all seems fine without using them. What do you think?
EDIT: I now found that all index files are re-exported in
alphatab.ts
, which makes sense for exposing every class to a user. (These imports use different syntax + path + quotes than other imports for some reason, that's why I didn't see it at first). So I guess the above question is answered. But could be worth looking over to see if all wanted exports are included.Beta Was this translation helpful? Give feedback.
All reactions