Hacker News new | past | comments | ask | show | jobs | submit login

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?




> 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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: