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.