TypeScript: Guides and Practical Know-how | Page 17 | mironsoft Blog
TypeScript
-
Jan 26, 2025
Abstract classes combine a binding contract with shared implementation, making them the right tool whenever several classes need to share the same base logic. This article covers the exact syntax, the difference from plain interfaces using a Repository base class as an example, and explains why TypeScript fully erases the abstraction at compile time, while PHP actually enforces it at runtime.
-
Jan 26, 2025
After years of wrangling in the TC39 committee, JavaScript decorators have reached Stage 3. They enable class-level metaprogramming without Babel hacks: logging, memoization, validation and dependency injection as reusable annotations.
-
Jan 20, 2025
A project without compiler errors is not automatically type safe. any spreads unnoticed, through external libraries without types, through JSON.parse, and through implicitly inferred parameters. Type coverage makes these gaps visible, quantifies them in a single metric, and can be locked down as a CI gate against creeping regression.
-
Jan 15, 2025
Choosing the right TypeScript runtime directly shapes developer productivity and daily build speed. This article compares the three most common options for Node.js projects across startup time, type checking, and watch mode support, and explains when full type checking during execution actually matters and when a fast feedback loop is the better choice for one off scripts, local development, and CI pipelines.
-
Jan 14, 2025
A misconfigured module field in tsconfig.json or an incomplete exports map in package.json regularly causes ERR_REQUIRE_ESM or ERR_UNKNOWN_FILE_EXTENSION errors in TypeScript packages that only surface at the consumer's end. Understanding the differences between ESM and CommonJS at compile time avoids the dual-package hazard and delivers packages that work reliably in both worlds.
-
Jan 12, 2025
The official TypeScript compiler tsc is written in JavaScript and optimized for type safety, not speed. esbuild and swc compile the same TypeScript code in Go and Rust respectively, achieving ten to twenty times shorter build times, while deliberately skipping full type checking during transformation.
-
Jan 9, 2025
ESLint checks syntax and simple patterns well, but once a rule needs to know the actual type of an expression, that's no longer enough. The TypeScript Compiler API exposes Program, TypeChecker and diagnostics as public building blocks, letting you build custom, precise, type-aware checks directly on the real compiler.
-
Jan 6, 2025
Many TypeScript developers only know the never type as an abstract curiosity from the documentation, even though it is one of the most effective tools for exhaustiveness checking and type safe error handling. Whoever applies never deliberately lets the compiler catch impossible states instead of discovering them only at runtime.
-
Jan 6, 2025
Express ships with only weakly typed request and response objects out of the box. With generic types for body, params and query, typed middleware chains and a clear error class hierarchy, a fragile JavaScript framework becomes a TypeScript backend architecture that reports errors at compile time instead of at runtime.
-
Jan 4, 2025
as const forces the compiler to infer the narrowest possible literal type for an expression instead of widening it to a broad type like string or number[]. The result is more precise types, without writing any extra type definition.