Medium

Get Return Type

MEDIUM
0
16
@Type Challenges

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

For example

const fn = (v

Omit

MEDIUM
0
10
@Type Challenges

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

Constructs a type by picking all pr

Readonly 2

MEDIUM
0
15
@Type Challenges

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

K specify th

Deep Readonly

MEDIUM
3
14
@Type Challenges

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

Tuple to Union

MEDIUM
0
6
@Type Challenges

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

For

Chainable Options

MEDIUM
3
27
@Type Challenges

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

Last of Array

MEDIUM
0
6
@Type Challenges

TypeScript 4.0 is recommended in this challenge

Implement a generic Last<T> that takes an Arr

Pop

MEDIUM
1
3
@Type Challenges

TypeScript 4.0 is recommended in this challenge

Implement a generic Pop<T> that takes an Arra

Promise.all

MEDIUM
0
6
@Type Challenges

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

Type Lookup

MEDIUM
0
4
@Type Challenges

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
@Type Challenges

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

Trim

MEDIUM
0
2
@Type Challenges

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

Capitalize

MEDIUM
0
3
@Type Challenges

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

Replace

MEDIUM
0
7
@Type Challenges

Implement Replace<S, From, To> which replace the string From with To once in the given strin

ReplaceAll

MEDIUM
0
6
@Type Challenges

Implement ReplaceAll<S, From, To> which replace the all the substring From with To in the gi

Append Argument

MEDIUM
0
1
@Type Challenges

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

Permutation

MEDIUM
0
4
@Type Challenges

Implement permutation type that transforms union types into the array that includes permutations o

Length of String

MEDIUM
0
0
@Type Challenges

Compute the length of a string literal, which behaves like String#length.

Append to object

MEDIUM
0
2
@Type Challenges

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

Absolute

MEDIUM
0
8
@Type Challenges

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

String to Union

MEDIUM
0
1
@Type Challenges

Implement the String to Union type. Type take string argument. The output should be a union of inp

Merge

MEDIUM
2
1
@Type Challenges

Merge two types into a new type. Keys of the second type overrides keys of the first type.

For ex

KebabCase

MEDIUM
0
2
@Type Challenges

Replace the camelCase or PascalCase string with kebab-case.

FooBarBaz -> foo-bar-baz

F

Diff

MEDIUM
0
1
@Type Challenges

Get an Object that is the difference between O & O1

AnyOf

MEDIUM
1
0
@Type Challenges

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

IsNever

MEDIUM
1
2
@Type Challenges

Implement a type IsNever, which takes input type T. If the type of resolves to never, return `

IsUnion

MEDIUM
0
2
@Type Challenges

Implement a type IsUnion, which takes an input type T and returns whether T resolves to a un

ReplaceKeys

MEDIUM
0
1
@Type Challenges

Implement a type ReplaceKeys, that replace keys in union types, if some type has not this key, jus

Remove Index Signature

MEDIUM
0
4
@Type Challenges

Implement RemoveIndexSignature<T> , exclude the index signature from object types.

For example:

Percentage Parser

MEDIUM
0
0
@Type Challenges

Implement PercentageParser. According to the /^(\+|\-)?(\d*)?(\%)?$/ regularit

Drop Char

MEDIUM
0
0
@Type Challenges

Drop a specified char from a string.

For example:

type Butterfly = DropChar<' b u t t e r

MinusOne

MEDIUM
2
2
@Type Challenges

Given a number (always positive) as a type. Your type should return the number decreased by one.

PickByType

MEDIUM
0
1
@Type Challenges

From T, pick a set of properties whose type are assignable to U.

For Example

t

StartsWith

MEDIUM
0
0
@Type Challenges

Implement StartsWith<T, U> which takes two exact string types and returns whether T starts wit

EndsWith

MEDIUM
0
2
@Type Challenges

Implement EndsWith<T, U> which takes two exact string types and returns whether T ends with `U

PartialByKeys

MEDIUM
0
0
@Type Challenges

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

K specify

RequiredByKeys

MEDIUM
0
0
@Type Challenges

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

K specif

Mutable

MEDIUM
0
1
@Type Challenges

Implement the generic Mutable<T> which makes all properties in T mutable (not readonly

OmitByType

MEDIUM
0
0
@Type Challenges

From T, pick a set of properties whose type are not assignable to U.

For Example

ObjectEntries

MEDIUM
1
1
@Type Challenges

Implement the type version of Object.entries

For example

interface Model {

Shift

MEDIUM
0
0
@Type Challenges

Implement the type version of Array.shift

For example

type Result = Shift<[3

Tuple to Nested Object

MEDIUM
0
0
@Type Challenges

Given a tuple type T that only contains string type, and a type U, build an object rec

Reverse

MEDIUM
0
2
@Type Challenges

Implement the type version of Array.reverse

For example:

type a = Reverse<['

Flip Arguments

MEDIUM
0
0
@Type Challenges

Implement the type version of lodash's _.flip.

Type FlipArguments<T> requires functio

FlattenDepth

MEDIUM
0
5
@Type Challenges

Recursively flatten array up to depth times.

For example:

type a = FlattenDepth<[1

BEM style string

MEDIUM
0
1
@Type Challenges

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

Flip

MEDIUM
0
0
@Type Challenges

Implement the type of just-flip-object. Examples:

Flip<{ a: "x", b: "y", c: "z" }

Fibonacci Sequence

MEDIUM
0
0
@Type Challenges

Implement a generic Fibonacci<T> that takes a number T and returns its corresponding [Fibonacc

AllCombinations

MEDIUM
0
3
@Type Challenges

Implement type AllCombinations<S> that return all combinations of strings which use characte

Greater Than

MEDIUM
0
1
@Type Challenges

In This Challenge, You should implement a type GreaterThan<T, U> like T > U

Negative numbers

Zip

MEDIUM
0
0
@Type Challenges

In This Challenge, You should implement a type Zip<T, U>, T and U must be Tuple

type exp

IsTuple

MEDIUM
0
2
@Type Challenges

Implement a type IsTuple, which takes an input type T and returns whether T is t

Chunk

MEDIUM
0
0
@Type Challenges

Do you know lodash? Chunk is a very useful function in it, now let's implement it. `Chunk<T, N

Fill

MEDIUM
0
1
@Type Challenges

Fill, a common JavaScript function, now let us implement it with types. `Fill<T, N, Start?, End?

Trim Right

MEDIUM
0
0
@Type Challenges

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

Without

MEDIUM
0
0
@Type Challenges

Implement the type version of Lodash.without, Without<T, U> takes an Array T, number or array U an

Trunc

MEDIUM
0
0
@Type Challenges

Implement the type version of Math.trunc, which takes string or number and returns the integ

IndexOf

MEDIUM
0
0
@Type Challenges

Implement the type version of Array.indexOf, indexOf<T, U> takes an Array T, any U and returns the

Join

MEDIUM
0
1
@Type Challenges

Implement the type version of Array.join, Join<T, U> takes an Array T, string or number U and retu

LastIndexOf

MEDIUM
0
0
@Type Challenges

Implement the type version of Array.lastIndexOf, LastIndexOf<T, U> takes an Array ```

Unique

MEDIUM
0
1
@Type Challenges

Implement the type version of Lodash.uniq, Unique takes an Array T, returns the Array T without

MapTypes

MEDIUM
0
3
@Type Challenges

Implement MapTypes<T, R> which will transform types in object T to different types defined by ty

Construct Tuple

MEDIUM
0
0
@Type Challenges

Construct a tuple with a given length.

For example

type result = ConstructTuple<2> // expe

Number Range

MEDIUM
0
0
@Type Challenges

Sometimes we want to limit the range of numbers... For examples.

type result = NumberRange<2

Combination

MEDIUM
0
0
@Type Challenges

Given an array of strings, do Permutation & Combination. It's also useful for the prop types like

Subsequence

MEDIUM
0
0
@Type Challenges

Given an array of unique elements, return all possible subsequences.

A subsequence is a seque

CheckRepeatedChars

MEDIUM
1
0
@Type Challenges

Implement type CheckRepeatedChars<S> which will return whether type S contains duplica

FirstUniqueCharIndex

MEDIUM
0
0
@Type Challenges

Given a string s, find the first non-repeating character in it and return its index. If it does no

Parse URL Params

MEDIUM
0
0
@Type Challenges

You're required to implement a type-level parser to parse URL params string into an Union.

GetMiddleElement

MEDIUM
0
1
@Type Challenges

Get the middle element of the array by implementing a GetMiddleElement method, represented by an

Appear only once

MEDIUM
0
3
@Type Challenges

Find the elements in the target array that appear only once. For example:input: `[1,2,2,3,3,4,5,6,

Count Element Number To Object

MEDIUM
0
3
@Type Challenges

With type CountElementNumberToObject, get the number of occurrences of every item from an arra

Integer

MEDIUM
0
0
@Type Challenges

Please complete type Integer<T>, type T inherits from number, if T is an integer return it

ToPrimitive

MEDIUM
0
0
@Type Challenges

Convert a property of type literal (label type) to a primitive type.

For example

t

DeepMutable

MEDIUM
0
1
@Type Challenges

Implement a generic DeepMutable which make every parameter of an object - and its sub-objects r

All

MEDIUM
0
5
@Type Challenges

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

Filter

MEDIUM
0
0
@Type Challenges

Implement the type Filter<T, Predicate> takes an Array T, primitive type or union primitive ty

FindAll

MEDIUM
0
2
@Type Challenges

Given a pattern string P and a text string T, implement the type FindAll<T, P> that returns an A

Combination key type

MEDIUM
0
0
@Type Challenges
  1. Combine multiple modifier keys, but the same modifier key combination cannot appear.
  2. In the

Permutations of Tuple

MEDIUM
0
0
@Type Challenges

Given a generic tuple type T extends unknown[], write a type which produces all permutations o

Replace First

MEDIUM
0
0
@Type Challenges

Implement the type ReplaceFirst<T, S, R> which will replace the first occurrence of S in a tuple T

Transpose

MEDIUM
0
0
@Type Challenges

The transpose of a matrix is an operator which flips a matrix over its diagonal; that is, it switc

JSON Schema to TypeScript

MEDIUM
0
2
@Type Challenges

Implement the generic type JSONSchema2TS which will return the TypeScript type corresponding to th

Square

MEDIUM
0
0
@Type Challenges

Given a number, your type should return its square.

Triangular number

MEDIUM
0
0
@Type Challenges

Given a number N, find the Nth triangular number, i.e. 1 + 2 + 3 + ... + N

CartesianProduct

MEDIUM
0
0
@Type Challenges

Given 2 sets (unions), return its Cartesian product in a set of tuples, e.g.

CartesianProd

MergeAll

MEDIUM
0
0
@Type Challenges

Merge variadic number of types into a new type. If the keys overlap, its values should be merged i

CheckRepeatedTuple

MEDIUM
0
0
@Type Challenges

Implement type CheckRepeatedChars<T> which will return whether type T contains duplicated memb

Public Type

MEDIUM
0
0
@Type Challenges

Remove the key starting with _ from given type T.

ExtractToObject

MEDIUM
0
1
@Type Challenges

Implement a type that extract prop value to the interface. The type takes the two arguments. The o

IsOdd

MEDIUM
0
2
@Type Challenges

return true is a number is odd

Tower of hanoi

MEDIUM
0
2
@Type Challenges

Simulate the solution for the Tower of Hanoi puzzle. Your type should take the number of rings as

IsFixedStringLiteralType

MEDIUM
0
0
@Type Challenges

Sometimes you may want to determine whether a string literal is a definite type. For example, when

Compare Array Length

MEDIUM
0
0
@Type Challenges

Implement CompareArrayLength to compare two array length(T & U).

If length of T array is gre