摘要: The enum is an original syntax of TypeScript (it does not exist in JavaScript). So it is converted to like the following form as a result of transpila 阅读全文
posted @ 2022-11-16 22:35 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: Similar to Array.findIndex: type FindIndex<T extends readonly any[], K, ACC extends unknown[] = []> = T extends readonly [infer F, ...infer RT] ? K ex 阅读全文
posted @ 2022-11-16 22:34 Zhentiw 阅读(44) 评论(0) 推荐(0)
摘要: type OnPropChangedMethods<T> = { [Key in keyof T & string as `${Key}Changed`]: (cb: (newValue: T[Key]) => void) => void } declare function makeWatched 阅读全文
posted @ 2022-11-16 15:02 Zhentiw 阅读(16) 评论(0) 推荐(0)
摘要: type Placeholder<T extends string> = T extends `${string}{${infer P}}${infer REST}` ? P | Placeholder<REST> : never; declare function format<S extends 阅读全文
posted @ 2022-11-16 14:48 Zhentiw 阅读(29) 评论(0) 推荐(0)
摘要: Implement a type FilterOut<T, F> that filters out items of the given type F from the tuple T. For example, type Filtered = FilterOut<[1, 2, null, 3], 阅读全文
posted @ 2022-11-16 02:19 Zhentiw 阅读(19) 评论(0) 推荐(0)