Gradual Typing the Office Codebase: TypeScript as a Migration Strategy
Why Microsoft built TypeScript to add types to JavaScript incrementally, and how that bet scaled across Office web, VS Code, and the broader ecosystem.
Category
25 articles · 81 min of reading
Why Microsoft built TypeScript to add types to JavaScript incrementally, and how that bet scaled across Office web, VS Code, and the broader ecosystem.
composite, references, and solution-style tsconfig: incremental tsc, no more root skipLibCheck lie, and how path aliases fight references.
declarationMap and sourceMap for libraries: jumping from consumer code to your src, and the publish files you must not forget.
Numeric enums, const enums, and string unions: tree-shaking, isolatedModules, and why published .d.ts should usually avoid open-ended enums.
bundler resolution, extension requirements, package.json exports, and the mismatch between tsc and esbuild that still ships a broken import.
const type parameters (TypeScript 5.0): when T extends readonly any[] infers tuples of literals, and how that replaces as const on every call.
Signals are not just a new API — they change how change detection works. Here is the model that makes signal, computed, and effect click.
How to pull types out of functions and promises with infer, why unions distribute, and the [T] trick when you do not want that.
How to stop mixing user IDs and order IDs, when brands beat extra classes, and the limits of compile-time branding at runtime.
Practical rules for crossing the boundary between RxJS observables and Angular signals without introducing timing bugs or memory leaks.
Most brittle Angular tests fail because they test implementation, not behavior. A look at TestBed patterns that stay green through real refactors.
Angular's reactive forms went from returning any everywhere to fully inferred types. Here's what that buys you and where it still leaks.
Class-based guards are gone from the recommended path. Here's how functional guards and resolvers actually change route protection and data loading.
Stop hand-maintaining API interfaces that drift from the backend — generate them from OpenAPI and turn breaking changes into compile errors.
The inject() function didn't just shorten constructors — it decoupled dependency lookup from class instantiation entirely, and that changes what's possible.
How .d.ts files, module augmentation, and package.json exports maps work together, and the mistakes that quietly break your library's consumers.
The new block syntax replaces *ngIf and *ngFor with something faster to compile, easier to read, and harder to misuse.
A practical walkthrough of the compiler flags beyond strict: true that catch real bugs, plus how to adopt them on a large legacy codebase.
Replace scattered boolean flags with discriminated unions to make impossible UI and reducer states unrepresentable, not just unlikely.
Learn why satisfies beats plain annotations and as const for config-like objects, keeping literal types intact while still checking shape.
any, unknown, and never look like the same category of weird type but do opposite jobs — here's when each one is actually the right choice.
A tour of how TypeScript actually narrows types through your control flow, from typeof guards to custom predicates, and where narrowing quietly breaks.
Template literal types can enforce structure in strings like event names, route params, and object paths — and know exactly where to stop using them.
Partial, Pick, and Readonly aren't compiler magic — learn the conditional and mapped types they're built from, and use them to write your own.