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