Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

That `userService` example is just awful, it feels like it's trying to achieve so many things with exactly the worst options.

- Not using ES modules which is compounded by: - Creating a random "bag of crap" as I call it by throwing all the functions into an exported object - Can't even get static build time feedback about the functions you're calling or if they even eixst which you would if:

The better alternatives here are:

- Just have plain exported *functions* in an ES module - If you need shared state both functions access then export a plain class in an ES module



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: