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

Can’t speak for Go, but TS does provide the `Pick<T, K>` construct, essentially meaning “from a type T, I only require a subset of properties K”. This avoids needing to duplicate partials of the core interface.

It does now strongly couple you to the core interface—you can’t put this function in a separate module that’s unaware of the core interface anymore—and now if the core interface changes, the function implementation itself will break instead of the call sites (which could be a good or a bad thing).




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

Search: