Getting things right
So let's get out of the illusion of comparing code one character at a time and try to find an abstraction that can be applied to updating all of these data types. There are two key points of this abstraction that have already been mentioned in the previous section:
- A
change
contains the information that can transform the value of an item from one to another - Multiple changes could be generated or applied to one data item during a single synchronization
Now, starting from changes, let's think about what happens when an update
method of a client is called.
Finding abstraction
Take a closer look to the method update
of client:
- For data of the
'value'
type, first we create the change, including a new value, and then update the change ...
Get TypeScript Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.