//Definitions of tracked properties on the prototype interface TrackedPropertyDefinition { computed: boolean; } type TrackedPropertyDefinitionList = { [K in keyof T]: TrackedPropertyDefinition; } const TrackedPropertyDefinitionListKey = "_trackedPropertyDefinitions"; export const getTrackedPropertyDefinitionList = (obj: T) => ((obj as any)[TrackedPropertyDefinitionListKey] = (obj as any)[TrackedPropertyDefinitionListKey] || {}) as TrackedPropertyDefinitionList; export const registerTrackedPropertyDefinition = (proto: T, name: K, computed: boolean/*, initialValue: T[K]*/) => { const list = getTrackedPropertyDefinitionList(proto); list[name] = { computed }; }