Medium TypeScript Challenges

Take your TypeScript skills to the next level with these intermediate challenges

#2

Get Return Type

Implement the built-in `ReturnType<T>` generic without using it. Learn conditional types with `infer` in this medium-level challenge on TypeScriptPro.

Medium
#3

Omit

Implement the built-in `Omit<T, K>` generic without using it. Learn union type manipulation in this medium-level challenge on TypeScriptPro.

Medium
#8

Readonly 2

Implement a generic `MyReadonly2<T, K>` which takes two type argument `T` and `K`. Learn how to use `readonly` modifiers in this medium-level challenge on TypeScriptPro.

Medium
#9

Deep Readonly

Implement a generic `DeepReadonly<T>` which makes every parameter of an object - and its sub-objects recursively - readonly. Learn readonly modifiers in this medium-level challenge on TypeScriptPro.

Medium
#10

Tuple to Union

Implement a generic `TupleToUnion<T>` which covers the values of a tuple to its values union. Learn conditional types with `infer`, union type manipulation, tuple manipulation in this medium-level challenge on TypeScriptPro.

Medium
#12

Chainable Options

Chainable options are commonly used in Javascript. But when we switch to TypeScript, can you properly type it? Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.

Medium
#15

Last of Array

Extract the last element type from TypeScript arrays and tuples. Master conditional types with `infer` in this medium-level challenge on TypeScriptPro.

Medium
#16

Pop

Remove the last element from an array. Learn array type operations in this medium-level challenge on TypeScriptPro.

Medium
#20

Promise.all

Implement a type-safe version of Promise.all that preserves tuple types and recursively unwraps nested promises. Master advanced TypeScript techniques including recursive types, mapped types, and conditional types in this medium-level challenge on TypeScriptPro.

Medium
#62

Type Lookup

Implement the `LookUp<U, T>` type, that looks up a type in a union by its attributes. Learn union type manipulation in this medium-level challenge on TypeScriptPro.

Medium
#106

Trim Left

Implement `TrimLeft<T>` which takes an exact string type and returns a new string with the whitespace beginning removed. Master advanced TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#108

Trim

Implement `Trim<T>` which takes an exact string type and returns a new string with the whitespace from both ends removed. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#110

Capitalize

Implement `Capitalize<T>` which converts the first letter of a string to uppercase and leave the rest as-is. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#116

Replace

Implement `Replace<S, From, To>` which replaces the string `From` with `To` in the given string `S`. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#119

ReplaceAll

Implement `ReplaceAll<S, From, To>` which replaces the substring `From` with `To` in the given string `S`. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#191

Append Argument

Implement the `AppendArgument<Fn, A>` type, that appends a new argument to parameters of a function type. Learn TypeScript function types in this medium-level challenge on TypeScriptPro.

Medium
#298

Length of String

Compute the length of a string literal, which behaves like `String.length`. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#527

Append to object

Implement a Generic Type that can append a new field to any object type. Master mapped types in TypeScript in this medium-level challenge on TypeScriptPro.

Medium
#529

Absolute

Implement the `Absolute` type. A type that takes string, number or bigint and returns a positive number string. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#531

String to Union

Implement the String to Union type, that turns a string into a union of its characters. Learn TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#599

Merge

Implement the `Merge<F, S>` type, that merges two types into a new type. Master mapped types in TypeScript in this medium-level challenge on TypeScriptPro.

Medium
#612

KebabCase

Replace the `camelCase` or `PascalCase` string with `kebab-case`. Learn TypeScript template literal types in this medium-level challenge on TypeScriptPro.

Medium
#645

Diff

Implement the `Diff<O, O1>` type, that returns an object with the difference between two objects. Master union and intersection types in TypeScript in this medium-level challenge on TypeScriptPro.

Medium
#1042

IsNever

Implement a `IsNever` Generic, which allows you to check if a type is never. Learn type distribution in TypeScript in this medium-level challenge on TypeScriptPro.

Medium
#2070

Drop Char

Implement the `DropChar<S, C>` type, that drops a specified char from a string. Learn template literal types in TypeScript in this medium-level challenge on TypeScriptPro.

Medium
#3192

Reverse

Implement the type version of `Array.reverse()`. Learn tuple manipulation in TypeScript in this medium-level challenge on TypeScriptPro.

Medium

Looking for a tougher challenge? Try our hard challenges!

We only send TypeScript related emails. No spam. Unsubscribe anytime.