摘要: For example: const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const type result = TupleToObject<typeof tuple> // expected { tesla: 'tesla', 阅读全文
posted @ 2022-08-31 15:51 Zhentiw 阅读(29) 评论(0) 推荐(0) 编辑
摘要: For example: interface Todo { title: string description: string } const todo: MyReadonly<Todo> = { title: "Hey", description: "foobar" } todo.title = 阅读全文
posted @ 2022-08-31 15:26 Zhentiw 阅读(26) 评论(0) 推荐(0) 编辑
摘要: For example: interface Todo { title: string description: string completed: boolean } type TodoPreview = MyPick<Todo, 'title' | 'completed'> const todo 阅读全文
posted @ 2022-08-31 15:23 Zhentiw 阅读(32) 评论(0) 推荐(0) 编辑
摘要: Reuse existing instances when working with identical objects The flyweight pattern is useful when you're creating a huge number of objects, which coul 阅读全文
posted @ 2022-08-31 14:59 Zhentiw 阅读(15) 评论(0) 推荐(0) 编辑