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=> {


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

  1. 754765 803228Oh my goodness! an wonderful write-up dude. Thank you Even so My business is experiencing dilemma with ur rss . Dont know why Unable to subscribe to it. Can there be anyone obtaining identical rss problem? Anybody who knows kindly respond. Thnkx 141344

  2. An interesting discussion is worth comment. There’s no doubt that that you
    ought to publish more on this subject, it may not be a taboo subject but
    typically people don’t speak about these issues.
    To the next! Kind regards!!


Leave a Comment