Categories
TypeScript Answers

How to access static methods in TypeScript?

Spread the love

Sometimes, we want to access static methods in TypeScript.

In this article, we’ll look at how to access static methods in TypeScript.

How to access static methods in TypeScript?

To access static methods in TypeScript, we just access them directly from the class.

For instance, if we have

class Logger {
  static Log() {
    /// ...
  }
}

Then we can call the Log method by writing

Logger.Log();

Conclusion

To access static methods in TypeScript, we just access them directly from the class.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *