index.d.ts 670 B

12345678910111213
  1. /**
  2. * Determines the type of the given collection, or returns false.
  3. *
  4. * @param {unknown} value The potential collection
  5. * @returns {'Map' | 'Set' | 'WeakMap' | 'WeakSet' | false} 'Map' | 'Set' | 'WeakMap' | 'WeakSet' | false
  6. */
  7. declare function whichCollection<K, V>(value: Map<K, V>): 'Map';
  8. declare function whichCollection<T>(value: Set<T>): 'Set';
  9. declare function whichCollection<K extends WeakKey, V>(value: WeakMap<K, V>): 'WeakMap';
  10. declare function whichCollection<T extends WeakKey>(value: WeakSet<T>): 'WeakSet';
  11. declare function whichCollection(value: null | undefined | boolean | number | bigint | symbol | unknown): false;
  12. export = whichCollection;