上一页 1 ··· 103 104 105 106 107 108 109 110 111 ··· 494 下一页
摘要: We want to convert export type Entity = | {type: "user"} | {type: "post"} | {type: "comment"} to type EntityWithId = | {type: "user", userId: string} 阅读全文
posted @ 2022-09-28 14:03 Zhentiw 阅读(14) 评论(0) 推荐(0)
摘要: Implement Python liked any function in the type system. A type takes the Array and returns true if any element of the Array is true. If the Array is e 阅读全文
posted @ 2022-09-28 01:39 Zhentiw 阅读(14) 评论(0) 推荐(0)
摘要: microtask -> requestAnimationFrame -> macrotask Each scheduler can just take callback as arguement asyncScheduler.schedule(() => console.log('async')) 阅读全文
posted @ 2022-09-27 21:41 Zhentiw 阅读(30) 评论(0) 推荐(0)
摘要: Get an Object that is the difference between O & O1 /* _____________ Your Code Here _____________ */ type Diff<T, S> = { [K in Exclude<(keyof T | keyo 阅读全文
posted @ 2022-09-27 01:47 Zhentiw 阅读(33) 评论(0) 推荐(0)
摘要: const fruitCounts = { apple: 12, banana: 23 } type PropUnion<T extends Record<PropertyKey, any>> = { [K in keyof T]: { [K2 in K]: T[K2] } }[keyof T] t 阅读全文
posted @ 2022-09-26 13:53 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: ShareReplay is using ReplaySubject. It will reply the messages to later subscribers. It turns unicast observable to multicase observable. shareReplay( 阅读全文
posted @ 2022-09-26 13:29 Zhentiw 阅读(182) 评论(0) 推荐(0)
摘要: Store.js import { BehaviorSubject, Subject } from 'rxjs'; import { map, distinctUntilKeyChanged, scan } from 'rxjs/operators'; export class Observable 阅读全文
posted @ 2022-09-26 13:19 Zhentiw 阅读(35) 评论(0) 推荐(0)
摘要: Replace the camelCase or PascalCase string with kebab-case. FooBarBaz -> foo-bar-baz For example type FooBarBaz = KebabCase<"FooBarBaz">; const foobar 阅读全文
posted @ 2022-09-26 03:02 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: Merge two types into a new type. Keys of the second type overrides keys of the first type. For example type foo = { name: string; age: string; } type 阅读全文
posted @ 2022-09-25 03:12 Zhentiw 阅读(42) 评论(0) 推荐(0)
摘要: Implement the String to Union type. Type take string argument. The output should be a union of input letters For example type Test = '123'; type Resul 阅读全文
posted @ 2022-09-16 16:25 Zhentiw 阅读(29) 评论(0) 推荐(0)
上一页 1 ··· 103 104 105 106 107 108 109 110 111 ··· 494 下一页