i have a config.json
file
{
"profiler": {
"port": 8001,
"profilerCache": {
"allowedOriginsRegex": ["^http:\/\/localhost:8080$", "i"]
}
},
"database": {
"uri": "mongodb+srv://...",
"dbName": "profiler",
"collectionName": "profiles"
}
}
at build time, i want to see errors if the json structure doesn't match my interface for it
export interface Config {
port: number
profilerCache: {
allowedOriginsRegex: [string, string]
}
database: {
uri: string
dbName: string
collectionName: string
}
}
what's the simplest way to accomplish type safety for my json files?