2025-07-10
3293
Peter Aideloje
205750
110
Jul 10, 2025 â‹… 11 min read

React & TypeScript: 10 patterns for writing better code

Peter Aideloje I'm a passionate developer and technical writer whose interest aligns with full-stack software engineering, specifically Java, Csharp, and other frontend stacks like HTML5, CSS3, and JavaScript.

Recent posts:

The CSS if() function: Conditional styling will never be the same

The CSS Working Group has approved the if() function for development, a feature that promises to bring true conditional styling directly to our stylesheets.

Ikeh Akinyemi
Jul 30, 2025 â‹… 12 min read
what's new in next js 15.4

Next.js 15.4 is here: What’s new and what to expect

Next.js 15.4 is here, and it’s more than just a typical update. This version marks a major milestone for the framework and its growing ecosystem.

Abiola Farounbi
Jul 29, 2025 â‹… 6 min read
React logo over a dark blue abstract background with glowing network nodes and connections

Build interactive React UIs for LLM outputs using llm-ui

If you’re building an LLM-powered application, llm-ui is a powerful tool to help you add structure, flexibility, and polish to your AI interfaces.

Emmanuel John
Jul 29, 2025 â‹… 9 min read
How I Debug Faster With These Chrome DevTools Console Features

How I debug faster with these Chrome DevTools Console features

Improve the old-fashioned debugging JavaScript workflow by effectively using some lesser-known Chrome DevTools console features.

Shalitha Suranga
Jul 28, 2025 â‹… 9 min read
View all posts

2 Replies to "React & TypeScript: 10 patterns for writing better code"

  1. I would like to submit a code review for the Record utility snippet! It should read:

    type Role = “admin” | “employee” | “viewer”;

    type Permissions = Record;

    const permissions: Permissions = {
    admin: [“read”, “write”, “delete”],
    employee: [“read”, “write”],
    viewer: [“read”],
    };

    1) The Role type name defined and the name used in the Record utility are inconsistent.

    2) The colons are missing in the key: value pairs of the object literal.

    It’s tough to catch these things without the error highlighting that IDEs provide. Great article!

  2. Thank you for catching that and for taking the time to share your feedback!

    You’re absolutely right on both points:
    1. The Role type named defined in the Record utility should be consistent (Roles or Role) — and in the case of using ‘Role’, the correct syntax would be:

    type Permissions = Record;
    2. Also, the object literal should include colons in the key-value pairs, like so:

    const permissions: Permissions = {
    admin: [“read”, “write”, “delete”],
    employee: [“read”, “write”],
    viewer: [“read”],
    };

    Appreciate you pointing it out, great eye! I’m glad you enjoyed the piece!

Leave a Reply