The type of ParsedParametersObject["--mode"] must be one of Parameters[ValidFirstCommandPhrases.buildProject].mode.values. Currently it has been hardcoded, so when new supported mode will be added to application we need to edit both Parameters[ValidFirstCommandPhrases.buildProject].mode.values and ParsedParametersObject.
How I can convert Parameters[ValidFirstCommandPhrases.buildProject].mode.values to valid enum-like type?
enum ValidFirstCommandPhrases { initializeProject = "initializeProject", buildProject = "buildProject" } export const Parameters = { [ValidFirstCommandPhrases.buildProject]: { mode: { name__includingDoubleNDash: "--mode", values: { development: "development", production: "production", } }, debug: { name__includingDoubleNDash: "--debug" } } } as const; type ParsedParametersObject = { // --mode [Parameters[ValidFirstCommandPhrases.buildProject].mode.name__includingDoubleNDash]: "development" | "production"; // Hardcoded!! }