Model Types and Collections
TypeScript in Production notes about Model Types and Collections
TypeScript Pick vs Extract: Select Properties or Union Variants
Use Pick to select fields from a type, Extract to retain matching union members, and Extract before Pick when the fields belong to only one variant.
TypeScript Mapped Types: Reuse and Transform Interface Properties
Use Pick to retain selected interface properties and their types, Partial to make them optional, and a mapped type when every property needs a new value type.
How to Get an Array Element and Its Index in TypeScript
Use the second forEach callback parameter for an item’s index, or choose entries() or an indexed loop when they make the job clearer.
TypeScript Record: Type a Fixed Key Set or an Open Dictionary
Use a finite key union when every named entry is required, and Record<string, Value> when the keys are open-ended.
How to Type a TypeScript Class: Fields, Constructors, Methods, and Inheritance
Type class fields, constructors, and methods in one Account example, then extend it while keeping compiler checks separate from runtime behavior.
Using a Typed Map in TypeScript: Entries, Iteration, and When to Choose It
Use Map<string, number> when keyed data needs Map operations, and keep object properties separate from Map entries.
TypeScript Enums at Runtime: When to Choose Them Over String Unions
Choose a string-literal union for a compile-time restriction, or a regular enum when your code also needs named members and a runtime object.







