Explore our collection of hands-on TypeScript coding challenges. Perfect for beginners and experienced developers alike. Each challenge is designed to help you master real-world concepts, from basic types to advanced generics, with practical problems and detailed solution walkthroughs. Solve, learn, and improve your TypeScript expertise by taking on a new challenge today!
Start your TypeScript journey with the classic "Hello World" coding challenge. Learn by doing, get instant feedback, and master TypeScript basics step-by-step on TypeScriptPro.
Learn to implement TypeScript's built-in Pick utility type from scratch. Master type manipulation and generic constraints with this easy-level TypeScript challenge on TypeScriptPro.
Learn to implement TypeScript's built-in Readonly utility type from scratch. Master readonly properties and mapped types with this easy-level TypeScript challenge on TypeScriptPro.
Transform TypeScript tuples into object types with this easy-level challenge. Learn about const assertions, mapped types, and literal types on TypeScriptPro.
Extract the first element type from TypeScript arrays and tuples. Master indexed access types and conditional types in this easy-level challenge on TypeScriptPro.
Get the length of TypeScript tuples at the type level. Learn about tuple types and the length property in this easy-level challenge on TypeScriptPro.
Implement TypeScript's built-in Exclude utility type from scratch. Master conditional types and type distribution in this easy-level challenge on TypeScriptPro.
Unwrap Promise types recursively with TypeScript. Learn conditional types, infer keyword, and recursive types in this easy-level challenge on TypeScriptPro.
Implement conditional logic at the type level with TypeScript. Master conditional types and type constraints in this easy-level challenge on TypeScriptPro.
Implement array concatenation at the type level with TypeScript. Learn about tuple types and the spread operator in this easy-level challenge on TypeScriptPro.
Check if an array includes a value at the type level. Learn about recursive types and type equality in this easy-level TypeScript challenge on TypeScriptPro.
Add elements to the end of tuples with TypeScript's type system. Master the spread operator and tuple manipulation in this easy-level challenge on TypeScriptPro.
Add elements to the beginning of tuples with TypeScript. Learn tuple manipulation and spread operators in this easy-level challenge on TypeScriptPro.
Extract function parameter types with TypeScript. Master the infer keyword and function type manipulation in this easy-level challenge on TypeScriptPro.
Implement the built-in `ReturnType<T>` generic without using it. Learn conditional types with `infer` in this medium-level challenge on TypeScriptPro.
Implement the built-in `Omit<T, K>` generic without using it. Learn union type manipulation in this medium-level challenge on TypeScriptPro.
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.
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.
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.
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.
Extract the last element type from TypeScript arrays and tuples. Master conditional types with `infer` in this medium-level challenge on TypeScriptPro.
Remove the last element from an array. Learn array type operations in this medium-level challenge on TypeScriptPro.
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.
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.
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.
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.
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.
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.
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.
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.
Implement permutation type that transforms union types into the array that includes permutations of unions. Learn union type manipulation in this medium-level challenge on TypeScriptPro.
Compute the length of a string literal, which behaves like `String.length`. Master TypeScript template literal types in this medium-level challenge on TypeScriptPro.
In this challenge, you would need to write a type that takes an array and emitted the flatten array type. Learn array type operations in this medium-level challenge on TypeScriptPro.
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.
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.
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.
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.
Replace the `camelCase` or `PascalCase` string with `kebab-case`. Learn TypeScript template literal types in this medium-level challenge on TypeScriptPro.
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.
Implement Python liked `any` function in the type system. A type takes the Array and returns `true` if any element of the Array is true. If the Array is empty, return `false`. Learn array type operations in this medium-level challenge on TypeScriptPro.
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.
Implement a type `IsUnion`, which takes an input type `T` and returns whether `T` resolves to a union type. Learn union type manipulation in this medium-level challenge on TypeScriptPro.
Implement a type ReplaceKeys, that replace keys in union types, if some type has not this key, just skip replacing, Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement `RemoveIndexSignature<T>` , exclude the index signature from object types. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement PercentageParser<T extends string>. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
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.
Given a number (always positive) as a type. Your type should return the number decreased by one. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
From `T`, pick a set of properties whose type are assignable to `U`. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement `StartsWith<T, U>` which takes two exact string types and returns whether `T` starts with `U` Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement `EndsWith<T, U>` which takes two exact string types and returns whether `T` ends with `U` Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement a generic `PartialByKeys<T, K>` which takes two type argument `T` and `K`. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement a generic `RequiredByKeys<T, K>` which takes two type argument `T` and `K`. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement the generic ```Mutable<T>``` which makes all properties in ```T``` mutable (not readonly). Learn readonly modifiers in this medium-level challenge on TypeScriptPro.
From ```T```, pick a set of properties whose type are not assignable to ```U```. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement the type version of ```Object.entries``` Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement the type version of ```Array.shift``` Learn array type operations in this medium-level challenge on TypeScriptPro.
Given a tuple type ```T``` that only contains string type, and a type ```U```, build an object recursively. Learn tuple manipulation in this medium-level challenge on TypeScriptPro.
Implement the type version of `Array.reverse()`. Learn tuple manipulation in TypeScript in this medium-level challenge on TypeScriptPro.
Implement the type version of lodash's ```_.flip```. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Recursively flatten array up to depth times. Learn array type operations in this medium-level challenge on TypeScriptPro.
The Block, Element, Modifier methodology (BEM) is a popular naming convention for classes in CSS. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement the type of `just-flip-object`. Examples: Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement a generic `Fibonacci<T>` that takes a number `T` and returns its corresponding [Fibonacci number](https://en.wikipedia.org/wiki/Fibonacci_number). Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement type ```AllCombinations<S>``` that return all combinations of strings which use characters from ```S``` at most once. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
In This Challenge, You should implement a type `GreaterThan<T, U>` like `T > U` Learn array type operations in this medium-level challenge on TypeScriptPro.
In This Challenge, You should implement a type `Zip<T, U>`, T and U must be `Tuple` Learn tuple manipulation in this medium-level challenge on TypeScriptPro.
Implement a type ```IsTuple```, which takes an input type ```T``` and returns whether ```T``` is tuple type. Learn tuple manipulation in this medium-level challenge on TypeScriptPro.
Do you know `lodash`? `Chunk` is a very useful function in it, now let's implement it. Learn tuple manipulation in this medium-level challenge on TypeScriptPro.
`Fill`, a common JavaScript function, now let us implement it with types. Learn tuple manipulation in this medium-level challenge on TypeScriptPro.
Implement `TrimRight<T>` which takes an exact string type and returns a new string with the whitespace ending removed. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement the type version of Lodash.without, Without<T, U> takes an Array T, number or array U and returns an Array without the elements of U. Learn union type manipulation, array type operations in this medium-level challenge on TypeScriptPro.
Implement the type version of ```Math.trunc```, which takes string or number and returns the integer part of a number by removing any fractional digits. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement the type version of Array.indexOf, indexOf<T, U> takes an Array T, any U and returns the index of the first U in Array T. Learn array type operations in this medium-level challenge on TypeScriptPro.
Implement the type version of Array.join, Join<T, U> takes an Array T, string or number U and returns the Array T with U stitching up. Learn array type operations in this medium-level challenge on TypeScriptPro.
Implement the type version of ```Array.lastIndexOf```, ```LastIndexOf<T, U>``` takes an Array ```T```, any ```U``` and returns the index of the last ```U``` in Array ```T``` Learn array type operations in this medium-level challenge on TypeScriptPro.
Implement the type version of Lodash.uniq, Unique<T> takes an Array T, returns the Array T without repeated values. Learn array type operations in this medium-level challenge on TypeScriptPro.
Implement `MapTypes<T, R>` which will transform types in object T to different types defined by type R which has the following structure Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Construct a tuple with a given length. Learn tuple manipulation in this medium-level challenge on TypeScriptPro.
Sometimes we want to limit the range of numbers... Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Given an array of strings, do Permutation & Combination. Learn array type operations in this medium-level challenge on TypeScriptPro.
Given an array of unique elements, return all possible subsequences. Learn union type manipulation in this medium-level challenge on TypeScriptPro.
Implement type ```CheckRepeatedChars<S>``` which will return whether type ```S``` contains duplicated chars? Learn union type manipulation in this medium-level challenge on TypeScriptPro.
Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. (Inspired by [leetcode 387](https://leetcode.com/problems/first-unique-character-in-a-string/)) Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
You're required to implement a type-level parser to parse URL params string into an Union. Learn conditional types with `infer` in this medium-level challenge on TypeScriptPro.
Get the middle element of the array by implementing a `GetMiddleElement` method, represented by an array Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Find the elements in the target array that appear only once. For example:input: `[1,2,2,3,3,4,5,6,6,6]`,output: `[1,4,5]`. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
With type ``CountElementNumberToObject``, get the number of occurrences of every item from an array and return them in an object. For example: Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Please complete type `Integer<T>`, type `T` inherits from `number`, if `T` is an integer return it, otherwise return `never`. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Convert a property of type literal (label type) to a primitive type. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement a generic DeepMutable<T> which make every parameter of an object - and its sub-objects recursively - mutable. Learn recursive type definitions, readonly modifiers in this medium-level challenge on TypeScriptPro.
Returns true if all elements of the list are equal to the second parameter passed in, false if there are any mismatches. Learn array type operations in this medium-level challenge on TypeScriptPro.
Implement the type `Filter<T, Predicate>` takes an Array `T`, primitive type or union primitive type `Predicate` and returns an Array include the elements of `Predicate`. Learn array type operations in this medium-level challenge on TypeScriptPro.
Given a pattern string P and a text string T, implement the type `FindAll<T, P>` that returns an Array that contains all indices (0-indexed) from T where P matches. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
1. Combine multiple modifier keys, but the same modifier key combination cannot appear. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Given a generic tuple type `T extends unknown[]`, write a type which produces all permutations of `T` as a union. Learn union type manipulation, tuple manipulation in this medium-level challenge on TypeScriptPro.
Implement the type ReplaceFirst<T, S, R> which will replace the first occurrence of S in a tuple T with R. If no such S exists in T, the result should be T. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
The transpose of a matrix is an operator which flips a matrix over its diagonal; that is, it switches the row and column indices of the matrix A by producing another matrix, often denoted by A<sup>T</sup>. Learn array type operations in this medium-level challenge on TypeScriptPro.
Implement the generic type JSONSchema2TS which will return the TypeScript type corresponding to the given JSON schema. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Given a number, your type should return its square. Learn tuple manipulation, array type operations in this medium-level challenge on TypeScriptPro.
Given a number N, find the Nth triangular number, i.e. `1 + 2 + 3 + ... + N` Learn tuple manipulation, array type operations in this medium-level challenge on TypeScriptPro.
Given 2 sets (unions), return its Cartesian product in a set of tuples, e.g. Learn union type manipulation in this medium-level challenge on TypeScriptPro.
Merge variadic number of types into a new type. If the keys overlap, its values should be merged into an union. Learn union type manipulation, array type operations in this medium-level challenge on TypeScriptPro.
Implement type `CheckRepeatedChars<T>` which will return whether type `T` contains duplicated member Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Remove the key starting with `_` from given type `T`. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement a type that extract prop value to the interface. The type takes the two arguments. The output should be an object with the prop values. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement a type`DeepOmit`, Like Utility types [Omit](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys), A type takes two arguments. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
return true is a number is odd Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Simulate the solution for the Tower of Hanoi puzzle. Your type should take the number of rings as input an return an array of steps to move the rings from tower A to tower B using tower C as additional. Each entry in the array should be a pair of strings `[From, To]` which denotes ring being moved `From -> To`. Learn array type operations in this medium-level challenge on TypeScriptPro.
Sometimes you may want to determine whether a string literal is a definite type. For example, when you want to check whether the type specified as a class identifier is a fixed string literal type. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement `CompareArrayLength` to compare two array length(T & U). Learn array type operations in this medium-level challenge on TypeScriptPro.
### Defined Partial Record Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
### Longest Common Prefix Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
The trace of a square matrix is the sum of the elements on its main diagonal. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Determine if the given letter is an alphabet. Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.
Implement `Uppercase<T>`, convert all letter to uppercase Master advanced TypeScript type manipulation in this medium-level challenge on TypeScriptPro.