Treat external JSON as unsafe until validated.
Section: Errors and Validation Boundaries
Parse JSON into `unknown` first
typescript
typescript
const raw: unknown = JSON.parse(payload);Explanation
Using `unknown` forces validation before use and is safer than blindly asserting types.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Errors and Validation Boundaries
Narrow caught errors
Handle `unknown` errors in catch blocks safely.
Use access modifiers
Control visibility with `public`, `private`, and `protected`.