In my Typescript files, I've been exporting constant variables like this:
export const VALIDATION = {
AMOUNT_MAX_VALUE: 100_000_000,
AMOUNT_MIN_VALUE: 0,
DESCRIPTION_MAX_LENGTH: 50,
};
My constant files only contain this one export without any accompanying class. Recently, a colleague suggested that it might be better to export these same constants using an abstract class like this:
export abstract class VALIDATION {
public static readonly AMOUNT_MAX_VALUE = 100_000_000;
public static readonly AMOUNT_MIN_VALUE = 0;
public static readonly DESCRIPTION_MAX_LENGTH = 50;
};
The reasoning behind this suggestion is that it allows developers to easily see the values of the constant variables within VSCode.
Initially, I find this pattern of using an abstract class for exporting constant values unusual, and I haven't come across any resources discussing this approach elsewhere.
Would using an abstract class to export constant values result in any negative impact on the application during build or runtime?