I have an interface called Product
which includes properties such as name
, and I want to track changes to these products using a separate interface called Change
. A Change
should include the original Product
as well as all of its properties prefixed with the word previous
.
While manually creating this type is possible, I believe there may be a way to define a type for this. My current approach looks something like this:
type Previous<T> = T extends /* all properties of T prefixed with `previous` */
Any suggestions?