21 cards · Public · Shuffle

TypeScript - Fundamentals & Advanced Type Systems

Master TypeScript from foundational typing concepts to advanced conditional types and type inference patterns. Essential high-yield reference for building robust, type-safe applications.

Cards in this deck

(21 cards)

Preview terms and definitions before starting your study session.

#1
Term
Partial<T> Utility Type
Definition
Constructs a type with all properties of T set to optional (?).
Implementation under the hood:
typescript3 lines
type Partial<T> = {
  [P in keyof T]?: T[P];
};
#2
Term
Required<T> Utility Type
Definition
Constructs a type consisting of all properties of T set to required, removing optional modifiers (?).
Implementation:
typescript3 lines
type Required<T> = {
  [P in keyof T]-?: T[P];
};
#3
Term
any vs. unknown
Definition
any opts out of type checking entirely, allowing any operation without compile-time verification. unknown is the type-safe counterpart; any value can be assigned to unknown, but operations on it are prohibited until type narrowing or explicit type assertions are applied.
#4
Term
Union Types (|) vs. Intersection Types (&)
Definition
A Union Type (A | B) represents a value that can be either type A or type B. An Intersection Type (A & B) combines multiple types into one, requiring the value to satisfy all constituent types simultaneously.
#5
Term
interface vs. type Alias
Definition
interface defines object shapes and supports declaration merging (re-opening interfaces) and OOP-style extends. type aliases can represent object shapes, primitive types, unions, tuples, and mapped types, but cannot be re-opened for declaration merging.
#6
Term
Generic Syntax (<T>)
Definition
Generics provide variable components to type definitions, allowing functions, classes, and interfaces to operate over multiple types while maintaining strict type safety. Syntax: function identity<T>(arg: T): T { return arg; }.
#7
Term
User-Defined Type Guards (is operator)
Definition
Functions returning a type predicate in the format arg is Type to explicitly narrow types. Example:
typescript3 lines
function isString(val: unknown): val is string {
  return typeof val === "string";
}
When returning true, TypeScript narrows val to string in the calling scope.
#8
Term
Readonly<T> Utility Type
Definition
Constructs a type with all properties of T marked as readonly, preventing property reassignment at compile time.
Implementation:
typescript3 lines
type Readonly<T> = {
  readonly [P in keyof T]: T[P];
};
Showing 8 of 21 cards in this deck.
Study All Now