上一页 1 ··· 100 101 102 103 104 105 106 107 108 ··· 496 下一页
摘要: Must have Configure Jest to Run Setup for All Tests with Jest setupFilesAfterEnv We want to include '@testing-library/jest-dom'so that we can have suc 阅读全文
posted @ 2022-10-18 13:59 Zhentiw 阅读(41) 评论(0) 推荐(0)
摘要: This one little tip has saved me hours of refactoring time. Passing string | undefined instead of ?: string ensures that ALL call sites must be given 阅读全文
posted @ 2022-10-18 01:39 Zhentiw 阅读(31) 评论(0) 推荐(0)
摘要: The "noUncheckedIndexedAccess" is the most awesome config option you've never heard of. It makes accessing objects a lot safer, and also powers up Typ 阅读全文
posted @ 2022-10-18 01:33 Zhentiw 阅读(37) 评论(0) 推荐(0)
摘要: Mapping over a union type can feel tricky to conceptualise. But actually, TypeScript does it all for you - using Distributive Conditional Types. Here, 阅读全文
posted @ 2022-10-18 01:22 Zhentiw 阅读(41) 评论(0) 推荐(0)
摘要: Globals in TypeScript?! 🤯 declare global is a super useful tool for when you want to allow types to cross module boundaries. Here, we create a Global 阅读全文
posted @ 2022-10-18 01:18 Zhentiw 阅读(153) 评论(0) 推荐(0)
摘要: Given a tuple type T that only contains string type, and a type U, build an object recursively. type a = TupleToNestedObject<['a'], string> // {a: str 阅读全文
posted @ 2022-10-17 14:53 Zhentiw 阅读(31) 评论(0) 推荐(0)
摘要: Implement the type version of Array.shift For example type Result = Shift<[3, 2, 1]> // [2, 1] /* _____________ Your Code Here _____________ */ type S 阅读全文
posted @ 2022-10-17 14:41 Zhentiw 阅读(31) 评论(0) 推荐(0)
摘要: const { of } = require("rxjs"); const { mergeMap, map, delay, catchError } = require("rxjs/operators"); describe("subscribe & assert testing in RxJS", 阅读全文
posted @ 2022-10-17 14:12 Zhentiw 阅读(40) 评论(0) 推荐(0)
摘要: Implement the type version of Object.entries For example interface Model { name: string; age: number; locations: string[] | null; } type modelEntries 阅读全文
posted @ 2022-10-16 17:08 Zhentiw 阅读(31) 评论(0) 推荐(0)
摘要: Implement the generic Mutable<T> which makes all properties in T mutable (not readonly). For example interface Todo { readonly title: string readonly 阅读全文
posted @ 2022-10-15 20:36 Zhentiw 阅读(32) 评论(0) 推荐(0)
上一页 1 ··· 100 101 102 103 104 105 106 107 108 ··· 496 下一页