You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
722 B

3 years ago
import type {Sequence} from './types';
interface ForEachTrait<K, V> {
forEach(callback: (value: V, key: K, self: this) => void): void;
}
interface PlainObject<T> {
[key: string]: T;
}
export default function forEachWithNullKeys<V>(
iterable: Set<V>,
callback: (value: V, key: null) => void
): void;
export default function forEachWithNullKeys<K, V>(
iterable: ForEachTrait<K, V>,
callback: (value: V, key: K) => void
): void;
export default function forEachWithNullKeys<T>(
iterable: Iterator<T> | Iterable<T> | Sequence<T>,
callback: (item: T, key: null) => void
): void;
export default function forEachWithNullKeys<T>(
object: PlainObject<T>,
callback: (value: T, key: string) => void
): void;