mardi 10 janvier 2017

TypeScript reflection for interfaces

Is there a way to find out if interface's property is defined as read only? Say,

interface ITest {
    readonly foo: number;
}

Now, is there some sort of reflection or trickery for TypeScript to get this information? E.g. something like:

let info = Reflect.get(ITest, 'foo');

if (info.isReadOnly()) { ... }





Aucun commentaire:

Enregistrer un commentaire