TypeScript: Guides and Practical Know-how | Page 4 | mironsoft Blog
TypeScript
-
Feb 18, 2026
Writing event handlers in TypeScript with any or the generic Event type throws away autocomplete, risks runtime errors from invalid property access, and produces bugs that only surface in the browser. This article shows how to correctly type MouseEvent, KeyboardEvent, and CustomEvent, how to cleanly narrow target and currentTarget, and how a type-safe event emitter robustly connects components in Magento and Hyvae frontends.
-
Feb 17, 2026
String concatenation for Tailwind classes is error-prone, hard to read and does not scale to a real design system. The combination of clsx, tailwind-merge and class-variance-authority (CVA) solves this elegantly: type-safe variants, conflict-safe class merging and a single cn utility for the entire codebase.
-
Feb 14, 2026
An uncaught error in a React component destroys the entire component tree and shows the user a blank screen. Error Boundaries are the mechanism that isolates JavaScript errors in rendering, shows fallback UIs and keeps the application stable, when implemented correctly, reliably and with monitoring integration.
-
Feb 13, 2026
Fastify does not treat JSON Schema as an add on feature but as a core building block: the same schema validates incoming requests at runtime, speeds up response serialization and, combined with TypeBox, automatically delivers the matching TypeScript type, without developers maintaining types twice by hand.
-
Feb 5, 2026
Most TypeScript style guides end up as a long wiki page, written once and never read again. A style guide that actually works defines a clear scope, enforces rules automatically with ESLint and shows conventions through real examples instead of abstract prose.
-
Feb 2, 2026
TypeScript automatically infers most types from literals, return values, and surrounding context, so developers rarely need to annotate every variable by hand. This article explains how the compiler's inference engine actually works, when automatically inferred types are enough, and when explicit annotations meaningfully improve code quality and long term maintainability.
-
Jan 25, 2026
An unconstrained generic type parameter accepts almost anything and thereby blocks any meaningful access to properties or methods. With the extends keyword, keyof, and well-designed default values, type parameters can be deliberately narrowed so the compiler catches real errors and developers get reliable autocomplete while writing code. This article uses a typed pick-fields function to show how these concepts work together.
-
Jan 23, 2026
Using fetch() directly gives TypeScript no guarantee about the shape of the response: response.json() returns any, and a plain generic parameter validates nothing at runtime. This article shows how a generic fetch wrapper with typed error results, timeout handling, and a practical API client brings real type safety to Magento and headless projects.
-
Jan 22, 2026
A TypeScript library with dozens of internal modules produces just as many individual type declaration files on a standard build, with no visibility into which of them actually belong to the public API. API Extractor solves exactly this problem: a single rollup, a machine readable API report acting as a contract test, and release tags that spell out exactly what consumers are allowed to use.
-
Jan 19, 2026
Magento ships its GraphQL endpoint without type information for the client, which leaves storefront code trusting field names and nullability on faith. graphql-code-generator automatically generates TypeScript types and typed query documents from the real schema, so broken field access and forgotten null checks show up at compile time instead of in a real customer's checkout.