mercredi 27 février 2019

How to enumerate metadata properties?

So I can have this type of code in typescript (not working on the playground you need a copy with "emitDecoratorMetadata" option on)

import "reflect-metadata";    

class test {
    a: number;
    b: boolean;
    c: string;
}

Reflect.getMetadata("design:type", (new test()), "a")

But how can I enumerate all the metadata contained inside test - in the examples I've seen:

Reflect.getOwnMetadataKeys(test.prototype, "property")

But it's returning an empty array in my case.





Aucun commentaire:

Enregistrer un commentaire