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%

5 Topics

intermediate
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.
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.
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.
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.
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.