type OnPropChnagedMethods<T> = {
[Key in keyof T & string as `${Key}Changed`]: (cb: (newValue: T[Key]) => void) => void
}
declare function makeWatchedObject<T>(obj: T): T & OnPropChnagedMethods<T>;
let homer = makeWatchedObject({
firstName: "Homer",
age: 33,
location: "Springfield"
})
标签:Typescript,void,OnPropChnagedMethods,Medium,Key,106
From: https://www.cnblogs.com/Answer1215/p/16895957.html