@itrocks/reflect
Version:
Runtime introspection of TypeScript classes and their properties, including property type
33 lines (32 loc) • 1.33 kB
TypeScript
import 'reflect-metadata';
import { KeyOf } from '@itrocks/class-type';
import { Type } from '@itrocks/class-type';
import { PropertyDefaults } from '@itrocks/property-default';
import { PropertyTypes } from '@itrocks/property-type';
import { SortedArray } from '@itrocks/sorted-array';
import { ReflectProperty } from './property';
declare class Properties<T extends object> {
[s: string]: ReflectProperty<T>;
[Symbol.iterator](): Iterator<ReflectProperty<T>>;
}
declare class SortedPropertyNames<T extends object> extends SortedArray<KeyOf<T>> {
static get [Symbol.species](): ArrayConstructor;
constructor(object: T);
}
interface SortedPropertyNames<T extends object> extends SortedArray<KeyOf<T>> {
includes(property: string): property is KeyOf<T>;
}
export declare class ReflectClass<T extends object = object> {
readonly name: string;
readonly object: T | undefined;
readonly type: Type<T>;
constructor(object: T | Type<T>);
inheritedPropertyDefaults(propertyDefaults: PropertyDefaults): void;
inheritedPropertyTypes(propertyTypes: PropertyTypes): void;
get parent(): ReflectClass | null;
get properties(): Properties<T>;
get propertyDefaults(): PropertyDefaults;
get propertyNames(): SortedPropertyNames<T>;
get propertyTypes(): PropertyTypes;
}
export {};