上一页 1 ··· 89 90 91 92 93 94 95 96 97 ··· 469 下一页
摘要: Blog: https://www.geeksforgeeks.org/es6-trampoline-function/ Stackoverflow problem for recursion: const sumBelow = (number, sum = 0) => ( number 0 ? s 阅读全文
posted @ 2022-08-18 14:32 Zhentiw 阅读(30) 评论(0) 推荐(0) 编辑
摘要: Index Signature type Fruit = { name: string color: string mass: number } type Dict<T> = { [k: string]: T } // <- index signature const fruitCatalog: D 阅读全文
posted @ 2022-08-17 15:08 Zhentiw 阅读(31) 评论(0) 推荐(0) 编辑
摘要: Indexed Access types provide a mechanism for retrieving part(s) of an array or object type via indices. We’ll look at how this kind of type works, and 阅读全文
posted @ 2022-08-16 21:18 Zhentiw 阅读(28) 评论(0) 推荐(0) 编辑
摘要: For example we have a Webpack class: class WebpackCompiler { constructor(options: { amd?: false | { [index: string]: any } bail?: boolean cache?: | bo 阅读全文
posted @ 2022-08-16 21:07 Zhentiw 阅读(14) 评论(0) 推荐(0) 编辑
摘要: function lotteryNum() { return (Math.round(Math.random() * 100) % 58) + 1; } function recordNumber(luckLotteryNumbers: readonly number[], num: number) 阅读全文
posted @ 2022-08-15 19:13 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要: Extract is useful for obtaining some sub-part of a type that is assignable to some other type. type FavoriteColors = | "dark sienna" | "van dyke brown 阅读全文
posted @ 2022-08-15 18:53 Zhentiw 阅读(78) 评论(0) 推荐(0) 编辑
摘要: Let’s study a few examples of extends scenarios and see if we can figure out whether it will evaluate to true or false 64 extends number . . . Answer: 阅读全文
posted @ 2022-08-15 01:47 Zhentiw 阅读(15) 评论(0) 推荐(0) 编辑
摘要: keyof The keyof type query allows us to obtain type representing all property keys on a given interface. key can be string, number or Symbol. So what 阅读全文
posted @ 2022-08-10 19:30 Zhentiw 阅读(20) 评论(0) 推荐(0) 编辑
摘要: From source: https://www.typescript-training.com/course/intermediate-v1/03-modules/ Things can sometimes get a bit tricky when consuming CommonJS modu 阅读全文
posted @ 2022-08-10 01:15 Zhentiw 阅读(23) 评论(0) 推荐(0) 编辑
摘要: Stacking multiple things on an identifier interface Fruit { name: string mass: number color: string } const Fruit = { name: "banana", color: "yellow", 阅读全文
posted @ 2022-08-08 18:30 Zhentiw 阅读(19) 评论(0) 推荐(0) 编辑
上一页 1 ··· 89 90 91 92 93 94 95 96 97 ··· 469 下一页