Creating Mapped Types

Creating Mapped Types
πŸ‘¨β€πŸ’Ό Let's build our own utility types using mapped types!
type Album = {
	title: string
	year: number
}

type Optional<T> = { [K in keyof T]?: T[K] }
type OptionalAlbum = Optional<Album>
🐨 Open
index.ts
and:
  1. Recreate Partial<T> from scratch
  2. Recreate Required<T> from scratch
  3. Create a Nullable<T> that makes all properties nullable
  4. Create a Mutable<T> that removes readonly

Please set the playground first

Loading "Creating Mapped Types"
Loading "Creating Mapped Types"