index.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. declare function forEach<O extends readonly unknown[], This = undefined>(
  2. arr: O,
  3. callback: (this: This | void, value: O[number], index: number, array: O) => void,
  4. thisArg?: This,
  5. ): void;
  6. declare function forEach<O extends ArrayLike<unknown>, This = undefined>(
  7. arr: O,
  8. callback: (this: This | void, value: O[number], index: number, array: O) => void,
  9. thisArg?: This,
  10. ): void;
  11. declare function forEach<O extends object, This = undefined>(
  12. obj: O,
  13. callback: (this: This | void, value: O[keyof O], key: keyof O, obj: O) => void,
  14. thisArg?: This,
  15. ): void;
  16. declare function forEach<O extends string, This = undefined>(
  17. str: O,
  18. callback: (this: This | void, value: O[number], index: number, str: O) => void,
  19. thisArg: This,
  20. ): void;
  21. export = forEach;
  22. declare function forEachInternal<O, C extends (this: This | void, value: unknown, index: PropertyKey, obj: O) => void, This = undefined>(
  23. value: O,
  24. callback: C,
  25. thisArg?: This,
  26. ): void;
  27. declare namespace forEach {
  28. export type _internal = typeof forEachInternal;
  29. }