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

There are problems in their approach:

In the first case the behavior is quirky because they are passing an untyped object into a function. If the object is typed the behavior is consistent.

The second example is about classes. Classes are created as easy extension objects via inheritance and poly-instantiation. Those ideas are friendly concepts for many developers but they increase complexity so I intentionally avoid classes and use a custom ESLint rule to enforce such.

In the third case they can solve for complexity with a simple refactor. The two interfaces are structurally identical so they should be a single interface with either a union on property values (static literals) or by defining a property again a union of other interfaces called by reference.



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

Search: