How to read/get extended class static properties using the object iteration

In below code – MicroserviceError class extending BaseError class. When I iterate MicroserviceError using the "Object entries" method I’m getting only MicroserviceError class static properties. is there any methods or way to to get extended class static properties? Link Playground

    class BaseError {
    protected readonly _name: string;
    protected readonly _code: number;
    protected readonly _description: string;
    public static readonly DB_ERROR = new BaseError(
        `DB connection error`,
        `Our services are not able to reach database`

    protected constructor(code: number, name: string, discription: string) {
        this._name = name;
        this._code = code;
        this._description = discription;
class MicroserviceError extends BaseError {
    public static readonly UNKOWN_ERROR = new BaseError(
        "Unkown error in microservice",
        "We have ecnountered unkown error in  microservice, please try again. If problem persists please contact support with correlation id."

        public static readonly EXPRESS_SERVER_RUN_ERROR = new BaseError(
            "Unabe to run express server",
            "We have ecnountered unkown error in running REST service using express server"

const errorChecker = () => {
      let errorList :any = [];
      Object.entries(MicroserviceError).forEach(obj=> {


1 thought on “How to read/get extended class static properties using the object iteration”

Leave a Comment