Implement the type version of Lodash.intersection with a little difference. Intersection takes
Implement the type version of binary tree inorder traversal.
For example:
const tr
Implement the advanced util type GetRequired<T>
, which remains all the required fields
For exam
Capitalize the key of the object, and if the value is an array, iterate through the objects in the
Create a SnakeCase<T>
generic that turns a string formatted in camelCase into a string forma
Implement a type ValidDate
, which takes an input type T and returns whether T is a valid date.
The FizzBuzz problem is a classic test given in coding interviews. The task is simple:
Print in
Implement a generic IsRequiredKey<T, K>
that return whether K
are required keys of ``
Given a string
sequence of a letters f.e. AAABCCXXXXXXY
. Return run-length encoded string `3AB
Create a type-safe string join utility which can be used like so:
const hyphenJoiner = join
Implement type IsPalindrome<T>
to check whether a string or number is palindrome.
For exam
Sudoku is a famous paper and pencil game. The goal of Sudoku is to fill a 9x9 grid with numbers so
Implement BinaryAdd
to add two binary numbers together. The numbers should not be translated out
The enum is an original syntax of TypeScript (it does not exist in JavaScript). So it is converted
TypeScript 4.0 is recommended in this challenge
[Currying](https://en.wikipedia.org/wiki/Curryi
Drop the specified chars from a string.
For example:
type Butterfly = DropString<'foobar!'
Create a type-level function whose types is similar to Pinia lib
The get
function in lodash is a quite convenient helper f
Get all possible paths that could be called by _.get (a lod
Implement the type version of Object.fromEntries
For example:
interface Mode
Implement the advanced util type GetOptional<T>
, which remains all the optional fields
For exam
Implement a type Take<N, Arr>
that returns the first N
elements from an array Arr
. If N
is
Implement the advanced util type UnionToIntersection<U>
For example
type I = UnionToInte
There is a function in C language: printf
. This function allows us to print something with forma
Implement the advanced util type OptionalKeys<T>
, which picks all the optional keys into a union
TypeScript has structural type system, but sometimes you want a function to accept only some previ
Sometimes it's useful to detect if you have a value with any
type. This is especially helpful wh
Given an array of integers nums
and an integer target
, return true if two numbers such that th
Find the object containing the key in the union type by the key. It takes two parameters: a union
Implement CapitalizeWords<T>
which converts the first letter of each word of a string to upp
Implement the util type OptionalUndefined<T, Props>
that turns all the properties of T
that ca
Sometimes when working with numeric literals, we need to rule out (or enforce) that the provided n
You have a target object and a source array of objects. You need to copy property from source to t
Implement a type DeepPick, that extends Utility types Pick
.
A type takes two arguments.
For ex
Implement the type Maximum
, which takes an input type T
, and returns the
Implement a type LengthOfString<S>
that calculates the length of the template string (as in [298
Implement CamelCase<T>
which converts snake_case
string to camelCase
.
For example
ty
Given an union of types
and array of type pairs
to replace ([[string, number], [Date, null]]
Implement Format<T extends string>
generic.
For example,
type FormatCase1 = Format<"%sab
Implement the advanced util type MutableKeys, which picks all the mutable (not readonly) keys i
**This challenge continues from 6 - Simple Vue, you should finish that one firs
Implement a type LengthOfString<S>
just like Array#length
:
Differing to two previous challeng
Implement a simpiled version of a Vue-like typing support.
By providing a function name `SimpleVu
Implement the advanced util type RequiredKeys<T>
, which picks all the required keys into a union
Convert a string literal to a number, which behaves like Number.parseInt
.
The well known split()
method splits a string into an array of substrings by looking for a separ
Implement a type FilterOut<T, F>
that filters out items of the given type F
from the tuple T
Implement Camelize which converts object from snake_case to to camelCase
Camelize<{ some_
Some concepts in TypeScript can not be described by types, but can be expressed through type const
Implement a type, UnionToTuple
, that converts a union to a tuple.
As we know, union is an unord
How can we build a type that "unboxes" arrays, functions, promises, and tuples?
Example:
Implement the generic ClassPublicKeys<T>
which returns all public keys of a class.
For example:
Implement BitwiseXOR<S1,S2>
which takes two binary string literal type and returns a binary
Implement BinaryToDecimal<S>
which takes an exact string type S
consisting 0 and 1 and returns
Write a type that verifies Sudoku game is solved. This is
Create a type Path
that represents validates a possible path of a tree under the form of an ar