When running the code sample below, it outputs "[Function: Date]", which is as expected.
import 'reflect-metadata'
function logType(target : any, key : string) {
var t = Reflect.getMetadata("design:type", target, key);
console.log(`${key} type: ${t.name}`);
}
export class Demo {
@logType // apply property decorator
test: Date;
}
let demo = new Demo();
console.log(Reflect.getMetadata('design:type', demo, "test"));
However, when I incorporate this same code into an Angular 2 Project, it returns "function Object() { [native code] }" instead.
I have created a Plunker to demonstrate this: https://plnkr.co/edit/DhXT89U0q5fCOWlCrx6w?p=preview
Despite this issue, Reflect.getMetadata('design:type' ...) still functions correctly with custom classes and other builtin classes. The problem only arises with Date objects.
Can you help identify what mistake I am making?