摘要:
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. type Res = Join 阅读全文
摘要:
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. type Res = IndexOf 阅读全文
摘要:
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. For 阅读全文
摘要:
Let's say we have a simple app look like this: import { useEffect, useState } from "react"; function useFetch(config) { console.log("useFetch call"); 阅读全文
摘要:
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. type R 阅读全文
摘要:
Implement TrimRight<T> which takes an exact string type and returns a new string with the whitespace ending removed. For example: type Trimed = TrimRi 阅读全文
摘要:
Let say we have a simple counter app: import { useEffect, useState } from "react"; function useStopwatch() { const [count, setCount] = useState(0); us 阅读全文
摘要:
Fill, a common JavaScript function, now let us implement it with types. Fill<T, N, Start?, End?>, as you can see,Fill accepts four types of parameters 阅读全文