Special Typescript Types


  • any → flexibility but no type safety
  • unknown → not much flexibility but type safe
  • Type narrowing → runtime check to make sure that a value is a certain type

As a rule of thumb, use uknown over any and use type narrowing to determine a more accurate type.


  • Interfaces vs Type Alias
  • Enums & Tupples
  • Union Types
  • Intersection Types
  • Literal Types

Copyright 2023 © Borja Leiva

Made within London