function firstMatch<T>( items: readonly T[], accepts: (item: T) => boolean, ): T | undefined { return items.find(accepts); } const result = firstMatch([3, 8, 13], (value) => value > 5); console.log(result);