However, with frameworks like Next.js and Nuxt.js (and likely others), I've found that I don't need undefsafe due to the optional chaining and nullish coalescing features that are provided with ES2020 (which are polyfilled for us in these frameworks).
This means my code can go from this:
let v = undefsafe(this, 'pkg.services.vulns.count') || "not available";
let v = this.pkg.services?.vulns.count ?? "not available";
The nullish coalesce is useful because of
0, then the value of
v is, correctly, zero.