Currently we just read the config with TypeScript and validates the data types. But what If the user enters a negative number? Right, TypeScript will see it as valid number because it's a valid number but that is something we don't want.
We should read the JSON file with fs and parse it with JSON.parse. We have a default config hardcoded and we just update the values with what we read from the config.json If exist. So we have a better way for backward compatibility for later versions too.
Currently we just read the config with TypeScript and validates the data types. But what If the user enters a negative number? Right, TypeScript will see it as valid number because it's a valid number but that is something we don't want.
We should read the JSON file with
fs
and parse it withJSON.parse
. We have a default config hardcoded and we just update the values with what we read from theconfig.json
If exist. So we have a better way for backward compatibility for later versions too.