TypeScript Best Practices


Sections


Handling Errors

  • for readability, should explicitly type errors as unkonwn
try {
    const uhoh = JSON.parse('{"oops":"eeeeeeeeeeeee",');
} catch (error: unknown) {
    // ...
}
Made with Gatsby G Logo