I discovered something neat that is possible in TypeScript. Did you know that you can import JSON as a Javascript module? I didn't...
I had a configuration file like this:
In my tsconfig.json I had to set the resolveJsonModule
to true:
Now I could import the config file as a module. The nice thing is that I even get type checking and autocompletion!
Remark: Not enabling this option out of the box was done by the TypeScript team to avoid pulling in large JSON files that would consume a lot of memory.