19 ms·
I called it HasId, there's a withId RxJS operator to go with it that selects from an IdRecord<T> based on an inner observable that emits an ID string. Due to n
by spiralx 4y ago
I called it HasId, there's a withId RxJS operator to go with it that selects from an IdRecord<T> based on an inner observable that emits an ID string.
Due to nominal typing in TS you don't need to explicitly implement HasId anywhere either, meaning you don't end up with it cluttering up every single type with an ID field (plus imports).
- ttymck 4y agoIs "nominal typing" the same as structural or duck typing?
- jcparkyn 4y agoNo, they presumably meant to write "structural" because nominal is the opposite.
- klysm 4y agoNominal typing means that two types are different if they have the same structure but a different name. Structural typing is the case where they are considered the same type if they have the same structure.
- deleted 4y ago[deleted]
- quickthrower2 4y agoYeah I do the explicit types for me, even if the compiler can infer the type. Gets that squiggly line close the to root cause.