TypeScript: extracting parts of compound types via <code>infer</code>
Explains how to use TypeScript's 'infer' keyword to extract parts of compound types, with examples for arrays, functions, and built-in utilities.
2ality.com is the long-standing blog of Dr. Axel Rauschmayer, devoted to JavaScript, TypeScript and modern web development. The blog was launched in March 2005 and remains one of the deepest and most respected resources for ECMAScript, language fundamentals and evolving JS features. Axel writes detailed, clear, and specification-aware analyses of JavaScript behavior, type system tricks in TypeScript, best practices, and the internal mechanics of web technologies. The content ranges from diving into conditional types, tuple types, ESM-based package publishing, to tutorials on Node.js and shell scripting.
52 articles from this blog
Explains how to use TypeScript's 'infer' keyword to extract parts of compound types, with examples for arrays, functions, and built-in utilities.
TypeDoc's new {@includeCode} tag allows testing code examples in documentation by referencing specific regions from external test files.
Explains TypeScript's `satisfies` operator, showing how it checks type compatibility without widening inferred types, with examples.
Explains how to use TypeScript's `readonly` keyword to create immutable properties and types, with examples and compiler behavior.
A guide to publishing npm packages using TypeScript and native ECMAScript Modules (ESM), covering setup, configuration, and best practices.
A guide to advanced tuple type manipulation in TypeScript, covering syntax, variadic elements, and type-level computations.
Explains the new RegExp.escape() function in ECMAScript 2025 for safely escaping strings in regular expressions.
Explores TypeScript enums: their functionality, practical use cases, and alternative approaches for developers.
A comprehensive guide to understanding and configuring the tsconfig.json file for TypeScript projects, with practical examples and recommendations.
Explains ECMAScript 2025's new regular expression pattern modifiers, allowing flags like case-insensitivity to be applied to specific parts of a regex.
Explains the ECMAScript 'Import Attributes' feature for importing non-JavaScript artifacts like JSON and WebAssembly, now at Stage 4.
Node.js v23.6.0 introduces built-in TypeScript support via type stripping, explaining how it works and key differences from traditional TypeScript.