0
例如是否有可能做這樣的事情..在TypeScript中運行時是否可以檢測到重寫的方法?
export default class SuperClass {
public method(): void {
/* noop */
}
}
export default class SubClass extends SuperClass {
public method(): void {
/* useful work */
}
}
export default class SmallerClass extends SuperClass {
}
let a = new SubClass();
let b = new SmallerClass();
/* Something like this?.. */
a.overrides("method") => true;
b.overrides("method") => false;