Comment by worx

Comment by worx 17 hours ago

1 reply

Could you provide examples of such risks? Because in my understanding, if some function/constant is exported but never imported anywhere, then it must be dead code and never run. And if it was reachable, then TypeScript would fail the compilation. As such, it sounds reasonably safe to me to remove it.

I only see these potential risks:

1. Using a mix of TS/JS and having some blind spots where we could accidentally delete non-dead code without the compiler noticing.

2. Having and relying on side effects. For example, `export const foobar = thisFnWillDoSthImportant()` and then, yes, removing that would break things.

3. Having separate projects/libs where some consumer might be accessing your exports directly.

Do you see other risks than those?

koolba 16 hours ago

> Could you provide examples of such risks?

The risk is adding yet another dependency controlled by a third party that executes on your developer’s local machines and on your CI system.