reflect
Unified Reflection
This is a project to separate typescript-rtti's reflection library
into an independent library and implement other metadata formats. Currently supports emitDecoratorMetadata
and typescript-rtti
.
Usage
npm install @typescript-rtti/reflect
Traditional metadata (emitDecoratorMetadata
):
import { reflect } from '@typescript-rtti/reflect';
@dec() class A {
constructor(str : string, num : number) {
}
}
expect(reflect(A).parameters[0].type.isClass(String)).to.be.true;
typescript-rtti
import { reflect } from '@typescript-rtti/reflect';
class A {
constructor(str : string, num : number) {
}
}
expect(reflect(A).parameters[0].type.isClass(String)).to.be.true;