摘要: Implement the built-in Parameters generic without using it. For example: const foo = (arg1: string, arg2: number): void => {} type FunctionParamsType 阅读全文
posted @ 2022-09-03 23:44 Zhentiw 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Implement the type version of Array.unshift For example: type Result = Unshift<[1, 2], 0> // [0, 1, 2,] /* _____________ Your Code Here _____________ 阅读全文
posted @ 2022-09-03 23:34 Zhentiw 阅读(16) 评论(0) 推荐(0) 编辑
摘要: Implement the generic version of Array.push For example: type Result = Push<[1, 2], '3'> // [1, 2, '3'] /* _____________ Your Code Here _____________ 阅读全文
posted @ 2022-09-03 23:31 Zhentiw 阅读(32) 评论(0) 推荐(0) 编辑
摘要: Implement the Equal<T, U> For example: type isEqual = Equal<1, 1> // true Idea: Parameter type: <P>(x: P) => any Check P extends T ? 1: 2 Then check P 阅读全文
posted @ 2022-09-03 23:30 Zhentiw 阅读(24) 评论(0) 推荐(0) 编辑