Feature request: store constants for different build configurations #5376
Labels
Out of Scope
This idea sits outside of the TypeScript language design constraints
Suggestion
An idea for TypeScript
ASP.Net developers stores global constants in web.config. For different build configurations (Like Test, Debug, Release etc) they have different constants.
They have possibility to get constant by string key, and don't have possibily to chek existence of constant on development-time.
So, I have ts project, and want use different const , for example billingHost in different configurations
What i can do? i can define all constants in common module, and on run-time firstly substitute needed
constants values by configuration values, and then import this constants to consume modules.
I faced problem. I don't want another developers know about what test, debug constants i use.
I think constant should be generated on build-time.
Now I store constants in tsconfig.json
And on build-time i generate ts file which contains constants.
I have autocomple in consume files, and another developers can't see my test constants.
All constants stored in one file. Each team member (not necessary developer can change constant in config)
example of usage
May be we should investigate integration of this approach to typescript ecosystem?
For example add consts section to tsconfig + build configuration, and provide to compilation context needed consts?
Thank you!
The text was updated successfully, but these errors were encountered: