Safely retrieves a deeply nested value from a JSON object using dot notation, with optional fallback.
A dot-separated string path like "ui.settings.theme"
A fallback value returned if the path is not found.
The found value or the fallback.
const port = configSafeGet<number>("server.port", 3000);const theme = configSafeGet<string>("ui.settings.theme", "light");const output = configSafeGet<string>("outputDir", "./dist"); Copy
const port = configSafeGet<number>("server.port", 3000);const theme = configSafeGet<string>("ui.settings.theme", "light");const output = configSafeGet<string>("outputDir", "./dist");
Safely retrieves a deeply nested value from a JSON object using dot notation, with optional fallback.