Hacker News new | ask | show | jobs
by quickthrower2 2470 days ago
If I used this one weird trick, I'd want it to be compile time checked.

I'd stick that JSON in a separate file, get typescript to compile it "just to check it's OK" then get the compiled code and include it as a string using something like https://webpack.js.org/loaders/raw-loader/, I guess (not used it before).

There might be a leaner way to do this (maybe the whole thing can be done as a webpack loader in one step), but something like this.