Explore
Explore the challenges. Embrace the opportunity to grow, learn, and showcase your programming abilities. We hope you find the perfect challenge!
Explore the challenges. Embrace the opportunity to grow, learn, and showcase your programming abilities. We hope you find the perfect challenge!
Give generic function types to your functions
Generic types are like function arguments.
Generic type constraints allow us to restrict the possible types a generic type will accept.
Hello, World!
In Type Challenges, we use the type system itself to do the assertion.
For this ch
Index signatures allow us to handle types where the properties are a non-specific literal value.
Some types can be indexed to lookup a particular value.
If we have a type which is wrapped type like Promise. How we can get a type which is inside the wr
Implement the built-in Exclude<T, U>
Exclude from
T
those types that are assignable toU
Implement a generic First<T>
that takes an Array T
and returns its first element's type.
For
For given a tuple, you need create a generic Length
, pick the length of the tuple
For example:
Implement the built-in Readonly<T>
generic without using it.
Constructs a type with all proper
Given an array, transform it into an object type and the key/value must be in the provided array.
Currying is the technique of converting a function that
Implement a generic GetReadonlyKeys<T>
that returns a union of the readonly keys of an Object.
Implement a type-level integers comparator. We've provided an enum for indicating the comparison r
You're required to implement a type-level parser to parse URL query string into a object literal t
Implement the JavaScript Array.slice
function in the type system. Slice<Arr, Start, End>
takes
Implement a type Sum<A, B>
that summing two non-negative integers and returns the sum as a strin
Chainable options are commonly used in Javascript. But when we switch to TypeScript, can you prope
Implement a generic DeepReadonly<T>
which make every parameter of an object - and its sub-object
Implement the built-in ReturnType<T>
generic without using it.
For example
const fn = (v
Implement the built-in Omit<T, K>
generic without using it.
Constructs a type by picking all pr
Implement a generic MyReadonly2<T, K>
which takes two type argument T
and K
.
K
specify th
Implement a generic TupleToUnion<T>
which covers the values of a tuple to its values union.
For
TypeScript 4.0 is recommended in this challenge
[Currying](https://en.wikipedia.org/wiki/Curryi
Implement the advanced util type GetOptional<T>
, which remains all the optional fields
For exam
Implement the advanced util type GetRequired<T>
, which remains all the required fields
For exam
Implement the advanced util type RequiredKeys<T>
, which picks all the required keys into a union
Implement a simpiled version of a Vue-like typing support.
By providing a function name `SimpleVu
Implement the advanced util type UnionToIntersection<U>
For example
type I = UnionToInte