ESC

Type to search the knowledge base.

TypeScript

Guides in TypeScript. Written like documentation — short paragraphs, real examples, interview-relevant depth.

Type Narrowing

intermediate

How TypeScript refines types through control flow — predicates, discriminants, and patterns that keep strict mode honest.

intermediate

TypeScript for JavaScript Engineers

beginner

A practical on-ramp: what TS adds to JS, strict mode basics, gradual migration, and the frontend patterns that matter first.

beginner

Basic Types and Annotations

beginner

Primitives, arrays, objects, and function annotations TypeScript actually checks — plus where inference is enough and where it is not.

beginner

Typing React Props

beginner

Type component props with required/optional fields, children, unions for variants, and HTML attribute extension patterns.

beginner

Interfaces vs Type Aliases

beginner

When to use interface vs type in TypeScript — extension, unions, declaration merging, and a practical default for frontend apps.

beginner

Union and Intersection Types

beginner

Combine types with | and & — model alternatives, mixins, and why unions need narrowing while intersections require all members.

beginner

Typing React Events

intermediate

Correct event types for onClick, onChange, forms, and keyboard handlers in React TypeScript — synthetic events and target narrowing.

intermediate

Literal Types

beginner

String, number, and boolean literal types — model fixed variants, narrow with equality, and combine with unions for safe UI props.

beginner

Type Guards typeof and instanceof

beginner

Built-in typeof and instanceof narrowing, custom type predicates, and how guards differ from assertions in TypeScript.

beginner

Discriminated Unions for UI State

intermediate

Model loading, success, and error as mutually exclusive variants so TypeScript and your UI cannot show impossible states.

intermediate

Generics Basics

intermediate

Type parameters for functions, components, and data structures — constraints, inference, and the mistakes that produce any-shaped APIs.

intermediate

Generic Constraints

intermediate

Limit type parameters with extends so generics stay flexible but can safely use properties like id, length, or keyof T.

intermediate

keyof typeof and Indexed Access

intermediate

Derive keys and value types from objects with keyof, typeof, and T[K] — the toolkit behind typed forms, configs, and safe property access.

intermediate

Utility Types Partial Pick Omit

beginner

Use Partial, Required, Pick, Omit, and Record to reshape props and DTOs without rewriting object types by hand.

beginner

Readonly and const Assertions

intermediate

Freeze intent with readonly, Readonly<T>, and as const — keep literal types, prevent accidental mutation, and type config objects correctly.

intermediate

Enums vs Union Types

intermediate

When TypeScript enums help, when they hurt, and why string literal unions plus const objects win for most frontend code.

intermediate

Function Overloads

advanced

Declare multiple call signatures so one implementation returns different types based on arguments — without lying with unions everywhere.

advanced

Tuple Types

intermediate

Fixed-length arrays with per-position types — useState pairs, CSV rows, rest parameters, and labeled tuples in TypeScript.

intermediate

unknown vs any

beginner

Why unknown is the type-safe top type, how to narrow it, and when any is a deliberate escape hatch — not a default.

beginner

tsconfig Strict Flags

intermediate

What strict mode actually enables, flag-by-flag impact on frontend code, and a practical migration order for legacy apps.

intermediate

Non-null Assertion Operator

intermediate

What value! means in TypeScript, when non-null assertions are justified, and safer patterns that keep strictNullChecks honest.

intermediate

Type Assertions Safely

intermediate

When as Type is justified, why double assertions are a smell, and how to replace casts with narrowing, guards, and validation.

intermediate

Typing fetch Responses

intermediate

Type HTTP JSON safely — Response generics myths, unknown + schema parse, error unions, and React Query-friendly patterns.

intermediate

Generics in React Components

advanced

Type props that depend on item shape — lists, selects, and tables — with generic components, inference pitfalls, and TSX syntax quirks.

advanced

Runtime Validation with Schemas

intermediate

TypeScript types erase at runtime — validate JSON and form input with Zod (or similar) so parsed data is actually typed and safe.

intermediate

satisfies Operator

intermediate

Check a value against a type while keeping the narrow inferred type — config objects, route maps, and as const without losing literals.

intermediate

Template Literal Types

advanced

Build string types with `on${Event}`, extract route params, and type CSS-like APIs using TypeScript template literal types.

advanced

Conditional Types Intro

advanced

T extends U ? X : Y — how TypeScript picks types from conditions, distributes over unions, and powers utility types you already use.

advanced

Mapped Types Intro

advanced

Transform every property of a type with {[K in keyof T]: …} — the engine behind Partial, Readonly, Pick patterns, and typed form bags.

advanced

Declaration Files and DefinitelyTyped

intermediate

How .d.ts files describe JS to TypeScript, when to use @types packages, module augmentation, and writing minimal ambient types for untyped libs.

intermediate

Path Aliases and Tooling Sync

intermediate

Keep tsconfig paths, bundler aliases, Vitest, and ESLint in sync so @/ imports resolve everywhere — not just in the IDE.

intermediate

infer Keyword Basics

advanced

Use infer inside conditional types to extract return types, promise payloads, array elements, and function parameters.

advanced

Branded Types for IDs

advanced

Nominal-style UserId vs OrderId in TypeScript — prevent ID mixups at compile time with brands, parsers, and form boundaries.

advanced

Record and Partial patterns for Forms

intermediate

Type form values, errors, touched flags, and dirty maps with Record, Partial, and keyof so field names stay in sync.

intermediate

Narrowing with in Operator

beginner

Use the in operator to narrow unions by property presence — object shapes, optional fields, and when in is the wrong tool.

beginner

never Type and Exhaustiveness

intermediate

What never means, how exhaustive switches use it, and why unreachable code and empty unions show up in TypeScript errors.

intermediate