Completed Challenges

Default Generic Arguments

BEGINNER
6
116
@dimitropoulos
2 years ago

Default generic arguments allow you to optionally pass a generic argument.

Primitive Data Types

BEGINNER
20
86
@dimitropoulos
2 years ago

Your TypeScript journey starts with these building blocks.

Type Aliases

BEGINNER
6
60
@dimitropoulos
2 years ago

You can create multiple names for the same type.

Literal Types

BEGINNER
23
47
@dimitropoulos
2 years ago

TypeScript can be more specific than string or number. It can remember literal values.

Index Signatures

BEGINNER
8
64
@dimitropoulos
2 years ago

Index signatures allow us to handle types where the properties are a non-specific literal value.

The `typeof` Operator

BEGINNER
9
63
@dimitropoulos
2 years ago

When you need to create a type from existing JavaScript values, typeof is the tool for the job.

Indexed Types

BEGINNER
12
44
@dimitropoulos
2 years ago

Some types can be indexed to lookup a particular value.

The `keyof` operator

BEGINNER
5
37
@dimitropoulos
2 years ago

keyof allows us to extract a union of another type's keys.

Generic Type Arguments

BEGINNER
10
72
@dimitropoulos
2 years ago

Generic types are like function arguments.

Generic Type Constraints

BEGINNER
4
61
@dimitropoulos
2 years ago

Generic type constraints allow us to restrict the possible types a generic type will accept.

Mapped Object Types

BEGINNER
9
52
@dimitropoulos
2 years ago

Mapping objects is a foundational skill that allows you to write type translation logic.

Generic Function Arguments

BEGINNER
24
148
@dimitropoulos
2 years ago

Give generic function types to your functions

Hello World

BEGINNER
20
94
@typehero
7 months ago

Hello, World!

In Type Challenges, we use the type system itself to do the assertion.

For this ch

Type Unions

BEGINNER
4
28
@dimitropoulos
2 years ago

Type unions are a powerful tool that allow you to create a type that's many values all at once.

Readonly

EASY
2
42
@typehero
7 months ago

Implement the built-in Readonly<T> generic without using it.

Constructs a type with all proper

Tuple to Object

EASY
4
40
@typehero
7 months ago

Given an array, transform it into an object type and the key/value must be in the provided array.

First of Array

EASY
4
37
@typehero
7 months ago

Implement a generic First<T> that takes an Array T and returns its first element's type.

For

Length of Tuple

EASY
0
28
@typehero
7 months ago

For given a tuple, you need create a generic Length, pick the length of the tuple

For example:

Exclude

EASY
4
34
@typehero
7 months ago

Implement the built-in Exclude<T, U>

Exclude from T those types that are assignable to U

Awaited

EASY
16
56
@typehero
7 months ago

If we have a type which is a wrapped type like Promise, how can we get the type which is inside th

If

EASY
0
12
@typehero
7 months ago

Implement the util type If<C, T, F> which accepts condition C, a truthy value T, and a falsy

Concat

EASY
0
17
@typehero
7 months ago

Implement the JavaScript Array.concat function in the type system. A type takes the two argument

Includes

EASY
13
30
@typehero
7 months ago

Implement the JavaScript Array.includes function in the type system. A type takes the two argume

Push

EASY
1
16
@typehero
7 months ago

Implement the generic version of Array.push

For example:

type Result = Push<

Unshift

EASY
0
7
@typehero
7 months ago

Implement the type version of Array.unshift

For example:

type Result = Unshi

Parameters

EASY
0
15
@typehero
7 months ago

Implement the built-in Parameters generic without using it.

For example:

const foo = (a

The `Pick` builtin

EASY
1
15
@dimitropoulos
2 years ago

TypeScript ships with a Pick type. Learn how to make it yourself!

Get Return Type

MEDIUM
0
18
@typehero
7 months ago

Implement the built-in ReturnType<T> generic without using it.

For example

const fn = (v

Omit

MEDIUM
0
15
@typehero
7 months ago

Implement the built-in Omit<T, K> generic without using it.

Constructs a type by picking all pr

Readonly 2

MEDIUM
0
21
@typehero
7 months ago

Implement a generic MyReadonly2<T, K> which takes two type argument T and K.

K specify th

Deep Readonly

MEDIUM
6
19
@typehero
7 months ago

Implement a generic DeepReadonly<T> which make every parameter of an object - and its sub-object

Tuple to Union

MEDIUM
0
10
@typehero
7 months ago

Implement a generic TupleToUnion<T> which covers the values of a tuple to its values union.

For

Chainable Options

MEDIUM
3
34
@typehero
7 months ago

Chainable options are commonly used in Javascript. But when we switch to TypeScript, can you prope

Last of Array

MEDIUM
0
7
@typehero
7 months ago

TypeScript 4.0 is recommended in this challenge

Implement a generic Last<T> that takes an Arr

Pop

MEDIUM
1
6
@typehero
7 months ago

TypeScript 4.0 is recommended in this challenge

Implement a generic Pop<T> that takes an Arra

Promise.all

MEDIUM
0
10
@typehero
7 months ago

Type the function PromiseAll that accepts an array of PromiseLike objects, the returning value s

Type Lookup

MEDIUM
0
5
@typehero
7 months ago

Sometimes, you may want to look up a type in a union by its attributes.

In this challenge, we wou

Trim Left

MEDIUM
0
5
@typehero
7 months ago

Implement TrimLeft<T> which takes an exact string type and returns a new string with the whitesp

Trim

MEDIUM
0
5
@typehero
7 months ago

Implement Trim<T> which takes an exact string type and returns a new string with the whitespace

Capitalize

MEDIUM
0
6
@typehero
7 months ago

Implement Capitalize<T> which converts the first letter of a string to uppercase and leave the r

Absolute

MEDIUM
0
13
@typehero
7 months ago

Implement the Absolute type. A type that take string, number or bigint. The output should be a p

All

MEDIUM
0
5
@typehero
7 months ago

Returns true if all elements of the list are equal to the second parameter passed in, false if the

AnyOf

MEDIUM
1
2
@typehero
7 months ago

Implement Python liked any function in the type system. A type takes the Array and returns `true

Append Argument

MEDIUM
0
4
@typehero
7 months ago

For given function type Fn, and any type A (any in this context means we don't restrict the ty

Append to object

MEDIUM
0
4
@typehero
7 months ago

Implement a type that adds a new field to the interface. The type takes the three arguments. The o

BEM style string

MEDIUM
0
4
@typehero
7 months ago

The Block, Element, Modifier methodology (BEM) is a popular naming convention for classes in CSS.