#language
27 pages tagged language.
importlib-metadata
Package-level reference for importlib-metadata on PyPI — install, distribution lookups, entry points, and the stdlib relationship from Python 3.10+.
attrs
Package-level reference for attrs on PyPI — install, @define vs @attr.s, validators, converters, and comparison with dataclasses.
typeof & keyof
TypeScript's typeof promotes a runtime value into the type position; keyof extracts the union of property keys. Together they form the backbone of type-safe lookups, enum-from-object patterns, and inferred shapes.
Template Literal Types
Template literal types let TypeScript pattern-match and synthesize string types — covering Uppercase/Lowercase intrinsics, infer-based parsers (Split, Join, CamelCase), route-param extraction, JSON path keys, and typed i18n helpers.
Structural Typing
Understand TypeScript's structural type system — assignability is based on shape, not name; excess property checks are the one exception; nominal typing requires branded types or class privates.
satisfies Operator
TypeScript's satisfies operator checks a value against a type while preserving its narrow literal inferred type. The middle ground between an annotation that widens and an as cast that lies.
node:stream
Node.js streams — Readable, Writable, Duplex, and Transform, the modern pipeline() API, backpressure, async iterators, Web Streams interop, and patterns for piping files, HTTP bodies, and gzip compression.
node:fs
Node.js file system module — the three APIs (callback, sync, promises), reading and writing files, directory operations, watchers, atomic writes, and path module pairing.
infer Keyword
TypeScript's infer keyword declares a fresh type variable inside a conditional type, letting you pull a sub-type out of a matched shape. It powers ReturnType, Parameters, Awaited, and most advanced type extractors.
Discriminated Unions
Discriminated unions model finite states with a shared literal tag, enabling exhaustive narrowing in switch statements, Result-style error handling, reducer actions, and pattern-matched API responses.
Branded Types
Branded (a.k.a. nominal, opaque, tagged) types add a phantom marker to a primitive so the compiler refuses to mix two strings — useful for IDs, units, validated input, and money. Covers hand-rolled brands, type-fest's Opaque/Tagged, Zod's .brand(), class-based brands, and runtime validation pairings.
Utility Types
TypeScript's built-in generic utility types that transform existing types into new ones. Covers Partial, Required, Readonly, Record, Pick, Omit, Exclude, Extract, ReturnType, Awaited, and more.
Types vs Interfaces
TypeScript has two ways to define object shapes — type aliases and interface declarations. Learn when each is appropriate, how they differ in extension, merging, and composability.
Type-Only Imports & Exports
import type and export type erase at compile time, preventing runtime side-effects and enabling better tree-shaking. Covers inline type qualifiers, verbatimModuleSyntax, and common gotchas with enums and namespaces.
Type Narrowing
TypeScript narrowing refines broad types to specific ones within code branches. Covers typeof, instanceof, in, equality, assignment narrowing, discriminated unions, control flow analysis, and the never type.
Type Guards
User-defined type guards narrow types at runtime using the `is` predicate, assertion functions, generic guards, and class-based patterns. Covers API validation, DOM guards, and when to use Zod.
Regular Expressions
JavaScript has built-in RegExp support (ES2018+ with named groups, lookbehind, dotAll). Covers literal syntax, flags, character classes, methods, named captures, and common patterns.
Promises
JavaScript Promises represent the eventual completion or failure of an async operation. Covers states, chaining, combinators, callback conversion, AbortController, and common anti-patterns.
Mapped & Conditional Types
Mapped types iterate over type keys to create new types; conditional types pick between types based on a condition. Together they power all built-in utility types and advanced type composition.
Generics
TypeScript generics allow writing reusable, type-safe code that works over many types. Covers generic functions, interfaces, classes, constraints, keyof, conditional types, and the infer keyword.
Fetch API
The browser and Node 18+ built-in HTTP client that returns Promises. Covers GET/POST/PUT/DELETE, headers, error handling, streaming, AbortController, uploads, credentials, and CORS.
Error Handling
JavaScript error handling with try/catch/finally, built-in error types, custom error classes, error chaining with cause (ES2022), async errors, and practical patterns like result objects.
Enums
TypeScript enums create named constant sets as real runtime objects. Covers numeric, string, and const enums; reverse mapping; enum pitfalls; and when to prefer a union of string literals instead.
Decorators
TypeScript decorators annotate and transform classes and class members. Covers the TC39 stage-3 standard decorators (TS 5.0+), legacy experimentalDecorators, decorator factories, method/class/field decorators, and reflect-metadata for NestJS and Angular patterns.
Common TypeScript Errors
A reference for the most frequent TypeScript compiler errors — their meaning, a minimal reproduction, and the correct fix. Covers TS2304, TS2345, TS2339, TS2322, TS2532, TS2554, TS2307, TS2366, TS7006, TS2571, TS2769, TS2693, plus type assertions and ts-expect-error.
Async / Await
async/await syntax, error handling, parallel execution with Promise.all, sequential vs parallel loops, top-level await, AbortController, and common mistakes.
Array Methods
JavaScript arrays have ~30 built-in methods for transforming, searching, and reducing data. Covers mutation, non-mutation, search, boolean, iteration, and static methods with real examples.