上一页 1 ··· 108 109 110 111 112 113 114 115 116 ··· 492 下一页
摘要: Implement the JavaScript Array.concat function in the type system. A type takes the two arguments. The output should be a new array that includes inpu 阅读全文
posted @ 2022-09-02 19:20 Zhentiw 阅读(39) 评论(0) 推荐(0)
摘要: Implement a utils If which accepts condition C, a truthy return type T, and a falsy return type F. C is expected to be either true or false while T an 阅读全文
posted @ 2022-09-02 19:16 Zhentiw 阅读(25) 评论(0) 推荐(0)
摘要: If we have a type which is wrapped type like Promise. How we can get a type which is inside the wrapped type? For example: if we have Promise<ExampleT 阅读全文
posted @ 2022-09-02 01:44 Zhentiw 阅读(38) 评论(0) 推荐(0)
摘要: Implement the built-in Exclude<T, U> For example: type Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c' /* _____________ Your Code Here _________ 阅读全文
posted @ 2022-09-02 01:39 Zhentiw 阅读(33) 评论(0) 推荐(0)
摘要: For given a tuple, you need create a generic Length, pick the length of the tuple For example: type tesla = ['tesla', 'model 3', 'model X', 'model Y'] 阅读全文
posted @ 2022-09-02 01:37 Zhentiw 阅读(30) 评论(0) 推荐(0)
摘要: Implement a generic First<T> that takes an Array T and returns it's first element's type. type arr1 = ['a', 'b', 'c'] type arr2 = [3, 2, 1] type head1 阅读全文
posted @ 2022-09-02 01:30 Zhentiw 阅读(26) 评论(0) 推荐(0)
摘要: If you cannot catch those pesky errors for any reason. Maybe some lib is throwing them and you can't catch them. You can use: process.on('uncaughtExce 阅读全文
posted @ 2022-09-02 01:26 Zhentiw 阅读(19) 评论(0) 推荐(0)
摘要: 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 阅读(34) 评论(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 阅读(31) 评论(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 阅读(43) 评论(0) 推荐(0)
上一页 1 ··· 108 109 110 111 112 113 114 115 116 ··· 492 下一页