I'm trying to use reflection to decorate properties on a child class. I expected it to log out ChildClass but instead logs ParentClass.
import 'reflect-metadata';
export function Searchable(target: Object, property: string) {
Reflect.defineMetadata('searchable', true, target, property);
console.log(target);// <--- this prints ParentClass, not ChildClass. why?
}
abstract class ParentClass {
public id: string;
}
class ChildClass extends ParentClass {
@Searchable
public name: string;
}