Skip to main content

Your first challenge in 3 steps

Type Challenges uses TypeScript’s type system for assertions. Let’s start with the simplest challenge to understand how it works.
1

Open the Hello World challenge

The “Hello World” challenge is the perfect starting point. You can solve it in:For the fastest start, use the TypeScript Playground.
2

Understand the challenge

Here’s what you’ll see:
// This is your code to modify
type HelloWorld = any // expected to be a string
And the test cases that must pass:
import type { Equal, Expect, NotAny } from '@type-challenges/utils'

type cases = [
  Expect<NotAny<HelloWorld>>,
  Expect<Equal<HelloWorld, string>>,
]
The tests check two things:
  1. HelloWorld is not the any type
  2. HelloWorld equals the string type
3

Solve it

Change the type definition to make the tests pass:
type HelloWorld = string // ✅ Tests pass!
That’s it! If there are no type errors, you’ve solved the challenge.

Try a real challenge: Pick

Now let’s try something more practical. The Pick challenge asks you to implement TypeScript’s built-in Pick<T, K> utility type.

The challenge

Implement a type that picks a set of properties K from type T.
type MyPick<T, K> = any

Example usage

interface Todo {
  title: string
  description: string
  completed: boolean
}

type TodoPreview = MyPick<Todo, 'title' | 'completed'>

const todo: TodoPreview = {
  title: 'Clean room',
  completed: false,
  // description is not included
}

Expected behavior

type TodoPreview = MyPick<Todo, 'title' | 'completed'>
// Result: { title: string; completed: boolean }

type TodoTitle = MyPick<Todo, 'title'>
// Result: { title: string }
Think about:
  • How to iterate over keys in a type
  • How to constrain K to only be keys that exist in T
  • How to build a new object type with selected properties
type MyPick<T, K extends keyof T> = {
  [P in K]: T[P]
}
Explanation:
  • K extends keyof T - Constrains K to only be keys that exist in T
  • [P in K] - Mapped type that iterates over each key in K
  • T[P] - Gets the type of property P from T

Understanding difficulty levels

Warm-up

1 challenge - Introduction to how Type Challenges workPerfect for your first attempt

Easy

13 challenges - Basic type operationsExamples: Pick, Readonly, First of Array, Tuple Length

Medium

Advanced type manipulationsExamples: DeepReadonly, TrimLeft, Capitalize, Promise.all types

Hard & Extreme

Complex challengesExamples: CamelCase, Currying, Union to Intersection

Next steps

1

Choose your environment

2

Start with easy challenges

Work through the 13 easy challenges to build a strong foundation:
  • Pick
  • Readonly
  • Tuple to Object
  • First of Array
  • Length of Tuple
  • Exclude
  • Awaited
  • If
  • Concat
  • Includes
  • Push
  • Unshift
  • Parameters
3

Learn from the community

  • Check out solution discussions for different approaches
  • Join the Discord community
  • Share your own solutions
Pro tip: Don’t just copy solutions. Try to solve each challenge yourself first, then compare your solution with others to learn different approaches.

Helpful resources

Before tackling harder challenges, familiarize yourself with these TypeScript concepts:
Many real-world TypeScript libraries like type-fest started as solutions to similar type challenges. The skills you learn here directly apply to building better TypeScript projects.