TypeScript: Guides and Practical Know-how | Page 14 | mironsoft Blog
TypeScript
-
Apr 11, 2025
Developers coming from Magento or Symfony already know Dependency Injection from di.xml and the service container. This article shows how to apply the same principle in TypeScript projects, with constructor injection as the default pattern, interfaces as contracts for testable code, and a clear rule for when a DI container like InversifyJS actually earns its keep.
-
Apr 9, 2025
Bringing TypeScript in React to the right level means more than typing props with interfaces. The satisfies operator, Template Literal Types, generics in components and discriminated unions enable props APIs that are impossible to misuse at runtime, because TypeScript flags every error while you write the code.
-
Apr 6, 2025
TypeScript's strict mode isn't a single switch, it's a bundle of eight compiler flags that together decide real type safety. Teams that enable strict only after years of loose code often face thousands of errors at once and abandon the migration. This article shows which flags deliver the most value for the least effort and how an existing codebase can realistically be converted step by step.
-
Apr 6, 2025
Every request payload an API accepts is, from TypeScript's point of view, unknown at first, no matter how trustworthy the client appears. This article shows how the trust boundary pattern consistently anchors validation at the system boundary, with middleware that validates before every handler, typed request objects throughout the rest of the code, and structured error propagation that prevents unchecked data from reaching deeper into the application.
-
Apr 4, 2025
Anyone who ctrl clicks an imported type and lands in a generated .d.ts file instead of their own source code loses valuable debugging time. Declaration maps close exactly that gap and turn a TypeScript library into one that feels, inside the IDE, as if its source code lived right inside your own project.
-
Mar 30, 2025
The default codegen.yml from the quickstart barely covers half of what GraphQL Code Generator can actually do. Custom scalars, fragment masking and the near-operation-file preset decide whether generated code is a joy or a burden.
-
Mar 29, 2025
Nullish Coalescing (??) and Optional Chaining (?.) are the most important additions to JavaScript since ES2020. They replace fragile && chains and || fallbacks with precise, readable operators, with the crucial difference that they react only to null and undefined, not to every falsy value.
-
Mar 27, 2025
The React error boundary interface internally works with the type unknown for caught errors, which often forces fallback components to fall back on any or unsafe casts. With generic type parameters and discriminated error types, error boundaries can be built that hand the caller concrete, typed error information.
-
Mar 23, 2025
Server Actions move mutations directly into server functions that can be called from client components. Without careful typing of inputs, returns and error states, that convenience quickly turns into a source of invisible runtime errors.
-
Mar 19, 2025
Decorators extend classes, methods, and properties with reusable behavior without touching the underlying code. Since TypeScript 5.0, the new TC39 Stage 3 standard is available with no compiler flag, while Angular and older NestJS versions still rely on experimentalDecorators and reflect-metadata. This article walks through both systems with real code examples for logging, validation, and dependency injection.