上一页 1 ··· 86 87 88 89 90 91 92 93 94 ··· 494 下一页
摘要: Implement BinaryToDecimal<S> which takes an exact string type S consisting 0 and 1 and returns an exact number type corresponding with S when S is reg 阅读全文
posted @ 2022-12-02 21:41 Zhentiw 阅读(37) 评论(0) 推荐(0)
摘要: Implement the type version of Lodash.intersection with a little difference. Intersection takes an Array T containing several arrays or any type elemen 阅读全文
posted @ 2022-12-01 16:26 Zhentiw 阅读(28) 评论(0) 推荐(0)
摘要: type RGB = [number, number, number] const palette: Record<'red' | 'blue' | 'green', string | RGB> = { red: [255, 0, 0], green: "#00ff00", blue: [0,0,2 阅读全文
posted @ 2022-11-30 15:53 Zhentiw 阅读(25) 评论(0) 推荐(0)
摘要: Typescript 4.9 supports an upcoming feature: Auto-accessors: class Person { accessor name: string constructor(name: string) { this.name = name } } Und 阅读全文
posted @ 2022-11-30 15:24 Zhentiw 阅读(59) 评论(0) 推荐(0)
摘要: Before version 4.9, you will get type error for the code: interface Context { packageJSON: unknown } function tryGetPackageName(context: Context) { co 阅读全文
posted @ 2022-11-30 15:15 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: Implement the advanced util type MutableKeys, which picks all the mutable (not readonly) keys into a union. For example: type Keys = MutableKeys<{ rea 阅读全文
posted @ 2022-11-30 14:48 Zhentiw 阅读(33) 评论(0) 推荐(0)
摘要: Invoke by Promise: import { createMachine, interpret, send } from "xstate"; const machine = createMachine({ initial: "loading", states: { loading: { o 阅读全文
posted @ 2022-11-30 02:07 Zhentiw 阅读(56) 评论(0) 推荐(0)
摘要: function countBehavior(state, event) { if (event.type "INC") { return { ...state, count: state.count + 1 } } } function createActor(behavior, initialS 阅读全文
posted @ 2022-11-30 01:35 Zhentiw 阅读(38) 评论(0) 推荐(0)
摘要: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries Use the container-type property a value of size, inline-size, or normal. These 阅读全文
posted @ 2022-11-29 15:41 Zhentiw 阅读(98) 评论(0) 推荐(0)
摘要: Implement type IsPalindrome<T> to check whether a string or number is palindrome. For example: IsPalindrome<'abc'> // false IsPalindrome<121> // true 阅读全文
posted @ 2022-11-29 15:14 Zhentiw 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 86 87 88 89 90 91 92 93 94 ··· 494 下一页