lib.es2015.collection.d.ts 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*! *****************************************************************************
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  4. this file except in compliance with the License. You may obtain a copy of the
  5. License at http://www.apache.org/licenses/LICENSE-2.0
  6. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  7. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  8. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  9. MERCHANTABLITY OR NON-INFRINGEMENT.
  10. See the Apache Version 2.0 License for specific language governing permissions
  11. and limitations under the License.
  12. ***************************************************************************** */
  13. /// <reference no-default-lib="true"/>
  14. interface Map<K, V> {
  15. clear(): void;
  16. delete(key: K): boolean;
  17. forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
  18. get(key: K): V | undefined;
  19. has(key: K): boolean;
  20. set(key: K, value: V): this;
  21. readonly size: number;
  22. }
  23. interface MapConstructor {
  24. new(): Map<any, any>;
  25. new<K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
  26. readonly prototype: Map<any, any>;
  27. }
  28. declare var Map: MapConstructor;
  29. interface ReadonlyMap<K, V> {
  30. forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;
  31. get(key: K): V | undefined;
  32. has(key: K): boolean;
  33. readonly size: number;
  34. }
  35. interface WeakMap<K extends object, V> {
  36. delete(key: K): boolean;
  37. get(key: K): V | undefined;
  38. has(key: K): boolean;
  39. set(key: K, value: V): this;
  40. }
  41. interface WeakMapConstructor {
  42. new <K extends object = object, V = any>(entries?: readonly [K, V][] | null): WeakMap<K, V>;
  43. readonly prototype: WeakMap<object, any>;
  44. }
  45. declare var WeakMap: WeakMapConstructor;
  46. interface Set<T> {
  47. add(value: T): this;
  48. clear(): void;
  49. delete(value: T): boolean;
  50. forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
  51. has(value: T): boolean;
  52. readonly size: number;
  53. }
  54. interface SetConstructor {
  55. new <T = any>(values?: readonly T[] | null): Set<T>;
  56. readonly prototype: Set<any>;
  57. }
  58. declare var Set: SetConstructor;
  59. interface ReadonlySet<T> {
  60. forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
  61. has(value: T): boolean;
  62. readonly size: number;
  63. }
  64. interface WeakSet<T extends object> {
  65. add(value: T): this;
  66. delete(value: T): boolean;
  67. has(value: T): boolean;
  68. }
  69. interface WeakSetConstructor {
  70. new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>;
  71. readonly prototype: WeakSet<object>;
  72. }
  73. declare var WeakSet: WeakSetConstructor;