Deepkit Runtime Types // Examples

Iterate over class properties

Back to all Deepkit Runtime Types examples
import { ReflectionClass } from '@deepkit/type';

class User {
    id: number = 0;
    username: string = '';
    password: string = '';
}

const properties = ReflectionClass.from(User).getProperties();
for (const property of properties) {
    console.log(property.name, property.type);
}