JS Guide
HomeQuestionsTopicsCompaniesResources
BookmarksSearch

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeTopicstypescript

typescript

TypeScript types, generics, and advanced type programming

0 of 15 topics read0%

15 Topics

Advanced Type Patterns
advanced
12 min
Advanced TypeScript covers variance (how subtyping flows through generics), complex generic constraints (multiple bounds, recursive types), branded types for nominal typing, and declaration merging — these patterns appear in library authoring and senior-level interview questions.
TypeScript Fundamentals
beginner
8 min
TypeScript is a typed superset of JavaScript that compiles to plain JS — it catches type errors at compile time rather than runtime, enables intelligent IDE tooling (autocomplete, refactoring, go-to-definition), and has become the industry standard for production JavaScript applications.
Conditional Types
advanced
10 min
Conditional types use the syntax T extends U ? X : Y to branch at the type level — combined with the infer keyword to extract types from patterns and distributive behavior over unions, they power most of TypeScript's built-in utility types.
Declaration Files
advanced
10 min
Declaration files (.d.ts) provide type information for JavaScript code without implementations — they enable TypeScript to type-check against libraries, ambient declarations describe globals like window extensions, and module augmentation extends third-party package types.
Enums vs Union Types
intermediate
8 min
TypeScript enums compile to runtime objects (numeric enums auto-increment, string enums require explicit values), while union types are erased at compile time with zero overhead — most teams prefer string unions for string constants and reserve enums for cases needing runtime object access.
Function Types
beginner
8 min
TypeScript functions require parameter type annotations (return types are usually inferred), support optional parameters, default values, rest parameters, and function overloads — function type expressions describe callback signatures for higher-order functions.
Generics
intermediate
10 min
Generics let you write functions, classes, and types that work with any type while preserving type safety — the type parameter <T> acts as a variable at the type level, inferred from usage or constrained with extends to require specific shapes.
Interfaces vs Type Aliases
beginner
8 min
Interfaces define object shapes and can be extended with extends or merged via declaration merging — type aliases can represent any type (unions, tuples, primitives) but can't be merged, and the practical rule is to use interface for objects and type for everything else.
Mapped Types
advanced
10 min
Mapped types transform existing types by iterating over their keys with { [K in keyof T]: NewType } — modifiers add/remove readonly and optional, key remapping (as clause) filters or renames keys, and they power built-in utilities like Partial, Required, Readonly, and Record.
Module System
intermediate
9 min
TypeScript uses ES module syntax (import/export) with added features — import type ensures type-only imports are erased at runtime, module resolution strategies (node16, bundler) control how imports are resolved, and verbatimModuleSyntax enforces explicit type import annotations.
Template Literal Types
advanced
10 min
Template literal types use backtick syntax at the type level to construct string types from other types — combined with union distribution they generate combinatorial patterns, and with intrinsic string types (Uppercase, Lowercase, Capitalize) they enable type-safe event handlers, CSS values, and API routes.
Type Guards & Narrowing
intermediate
9 min
Type narrowing is TypeScript's ability to refine broad types into specific ones within conditional blocks — typeof checks primitives, instanceof checks classes, in checks properties, and custom type predicates (param is Type) enable reusable narrowing logic for discriminated unions and complex shapes.
Basic Types
beginner
8 min
TypeScript's type system includes primitives (string, number, boolean), arrays (number[] or Array<number>), tuples for fixed-length arrays, literal types for exact values, and special types — any opts out of checking, unknown is the type-safe alternative, never represents impossible values, and void marks functions that don't return.
Union & Intersection Types
beginner
8 min
Union types (A | B) represent values that can be one of several types and require narrowing to access type-specific properties — intersection types (A & B) combine multiple types into one that has all properties, and discriminated unions with a shared literal field are the most type-safe pattern for handling variants.
Utility Types
intermediate
10 min
TypeScript ships built-in utility types that transform existing types — Partial makes all properties optional, Pick/Omit select or exclude properties, Record constructs object types, and ReturnType/Parameters extract function signatures, all implemented using mapped and conditional types under the hood.