Arun Tyagi Arun Tyagi - 1 year ago 142
TypeScript Question

Static class in typescript

Is there any way to create an static class in typescript, node.js

I want to create an static class to keep all constants and string in that.

what could be the best way to do that ?

Answer Source

Sure you can define a class with static properties:

export class Constants {
    static MAX_VALUE = 99999;
    static MIN_VALUE = 0;

Then use it when you need:

import { Constants } from '../constants';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download