Brain Food
  • Brain Food
  • pages
    • Brain Food
    • docs
      • Developer Resources
      • book-notes
        • Eloquent Javascript - Marijn Haverbeke
        • Range - David Epstein
      • computer-science
        • The Impostor's Handbook - Rob Conery
      • javascript
        • Node JS
        • You Don't Know JS Yet (2nd Edition ) - Kyle Simpson
        • react
          • React Server Components
      • reading
        • 10 Thoughts From 100 Books
      • self-development
        • Personal OKRs - 2021 (July)
      • software-development
        • Advice to Myself When Starting as a Software Developer - Gergely Orosz
        • on-software-development
        • What Silicon Valley "Gets" About Software Engineers - Gergely Orosz
      • typescript
        • TypeScript Fundamentals
      • web
        • Performance Optimization
Powered by GitBook
On this page
  • Type Categories
  • Union Types

Was this helpful?

  1. pages
  2. docs
  3. typescript

TypeScript Fundamentals

Type Categories

  • Nominal. Typing is based on the "name" of something. The type system cares about the name of the class it originates from (Java, C++, C#, etc.)

  • Structural. Type system only cares about the structure or the shape of the object (TypeScript). TS is a structural system so that it can be incrementally adopted to JS, a dynamically typed language.

Union Types

A union type represents the OR operator. It's technically related to Set theory, but for the purposes of learning TS no need to understand that.

const outcome: "success" | "error";
PrevioustypescriptNextweb

Last updated 2 years ago

Was this helpful?