The pattern of using a constants.ts is not a good one. The fact that a variable or some block of code is constant tells me nothing about its use. Is it configuration? Is it an environmental variable? Is it a magic number? Based on the name of the file, I couldn’t guess; it could be all of these or none of these.

We should name files after what they do. queue.ts, config.ts, env.ts, main.ts, build.ts, Toolbar.tsx all give me a pretty good idea as to what I’ll find in the file.

If constants.ts contains a bunch of const variables related to other parts of the code, then those constants should go with that other code. Eg: QUEUE_TIMEOUT_MS should go in queue.ts or in config.ts, RUNTIME_ENV should go in config.ts or env.ts, and so on.

If something could easily go into two files, pick a file or create a third file. Chances are you can find some other places where you’ve got third-file-adjacent code and it might make sense to pull that out too.

Even if it feels nebulous to pull these constant variables out, you should do it because it will help you structure your project! I promise!

Please, please, please name files based on what they do, or what they are. I would no more create a constants.ts file that I would create a functions.ts or classes.ts file.