[Typescript] 107. Medium - FindIndex
typescript Medium 107
2023-09-14 09:00:44 时间
Similar to Array.findIndex:
type FindIndex<T extends readonly any[], K, ACC extends unknown[] = []> = T extends readonly [infer F, ...infer RT]
? K extends F
? ACC['length']
: FindIndex<RT, K, [...ACC, unknown]>
: -1;
相关文章
- [Typescript] 72. Medium - IndexOf
- [Typescript] 54. Medium - Tuple to Nested Object
- [Typescript] 34. Medium - String to Union
- [Typescript] 35. Medium - Absolute
- [Typescript challenge] 19. Medium - Tuple to Union
- [Typescript Challenges] 28. Medium - Replace
- [Parcel] Running TypeScript with parcel-bundler
- [Typescript] Use never for readable string
- [Typescript] 133. Medium - All
- [!Typescript] 82. Medium - Combination
- [Typescript] 62. Medium - Fibonacci Sequence
- [Typescript] 61. Medium. - Flip
- [Typescript] 59. Medium - InorderTraversal
- [TypeScript] Dynamically Allocate Function Types with Conditional Types in TypeScript
- [TypeScript] Deeply mark all the properties of a type as read-only in TypeScript
- [Algorithm] Maximum Contiguous Subarray algorithm implementation using TypeScript / JavaScript
- [TypeScript] Overload a Function with TypeScript’s Overload Signatures
- [Algorithms] Binary Search Algorithm using TypeScript
- [TypeScript] type inference
- 什么是 TypeScript 里的 Constructor signature