Arun Tyagi Arun Tyagi - 4 months ago 61
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 ?


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';