githrun

A CLI tool to run Python scrip...
Log | Files | Refs | README | LICENSE

lib.es2015.collection.d.ts (5229B)


      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 
      7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
      9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
     10 MERCHANTABLITY OR NON-INFRINGEMENT.
     11 
     12 See the Apache Version 2.0 License for specific language governing permissions
     13 and limitations under the License.
     14 ***************************************************************************** */
     15 
     16 
     17 /// <reference no-default-lib="true"/>
     18 
     19 interface Map<K, V> {
     20     clear(): void;
     21     /**
     22      * @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
     23      */
     24     delete(key: K): boolean;
     25     /**
     26      * Executes a provided function once per each key/value pair in the Map, in insertion order.
     27      */
     28     forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
     29     /**
     30      * Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
     31      * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
     32      */
     33     get(key: K): V | undefined;
     34     /**
     35      * @returns boolean indicating whether an element with the specified key exists or not.
     36      */
     37     has(key: K): boolean;
     38     /**
     39      * Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
     40      */
     41     set(key: K, value: V): this;
     42     /**
     43      * @returns the number of elements in the Map.
     44      */
     45     readonly size: number;
     46 }
     47 
     48 interface MapConstructor {
     49     new (): Map<any, any>;
     50     new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
     51     readonly prototype: Map<any, any>;
     52 }
     53 declare var Map: MapConstructor;
     54 
     55 interface ReadonlyMap<K, V> {
     56     forEach(callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any): void;
     57     get(key: K): V | undefined;
     58     has(key: K): boolean;
     59     readonly size: number;
     60 }
     61 
     62 interface WeakMap<K extends WeakKey, V> {
     63     /**
     64      * Removes the specified element from the WeakMap.
     65      * @returns true if the element was successfully removed, or false if it was not present.
     66      */
     67     delete(key: K): boolean;
     68     /**
     69      * @returns a specified element.
     70      */
     71     get(key: K): V | undefined;
     72     /**
     73      * @returns a boolean indicating whether an element with the specified key exists or not.
     74      */
     75     has(key: K): boolean;
     76     /**
     77      * Adds a new element with a specified key and value.
     78      * @param key Must be an object or symbol.
     79      */
     80     set(key: K, value: V): this;
     81 }
     82 
     83 interface WeakMapConstructor {
     84     new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
     85     readonly prototype: WeakMap<WeakKey, any>;
     86 }
     87 declare var WeakMap: WeakMapConstructor;
     88 
     89 interface Set<T> {
     90     /**
     91      * Appends a new element with a specified value to the end of the Set.
     92      */
     93     add(value: T): this;
     94 
     95     clear(): void;
     96     /**
     97      * Removes a specified value from the Set.
     98      * @returns Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
     99      */
    100     delete(value: T): boolean;
    101     /**
    102      * Executes a provided function once per each value in the Set object, in insertion order.
    103      */
    104     forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
    105     /**
    106      * @returns a boolean indicating whether an element with the specified value exists in the Set or not.
    107      */
    108     has(value: T): boolean;
    109     /**
    110      * @returns the number of (unique) elements in Set.
    111      */
    112     readonly size: number;
    113 }
    114 
    115 interface SetConstructor {
    116     new <T = any>(values?: readonly T[] | null): Set<T>;
    117     readonly prototype: Set<any>;
    118 }
    119 declare var Set: SetConstructor;
    120 
    121 interface ReadonlySet<T> {
    122     forEach(callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any): void;
    123     has(value: T): boolean;
    124     readonly size: number;
    125 }
    126 
    127 interface WeakSet<T extends WeakKey> {
    128     /**
    129      * Appends a new value to the end of the WeakSet.
    130      */
    131     add(value: T): this;
    132     /**
    133      * Removes the specified element from the WeakSet.
    134      * @returns Returns true if the element existed and has been removed, or false if the element does not exist.
    135      */
    136     delete(value: T): boolean;
    137     /**
    138      * @returns a boolean indicating whether a value exists in the WeakSet or not.
    139      */
    140     has(value: T): boolean;
    141 }
    142 
    143 interface WeakSetConstructor {
    144     new <T extends WeakKey = WeakKey>(values?: readonly T[] | null): WeakSet<T>;
    145     readonly prototype: WeakSet<WeakKey>;
    146 }
    147 declare var WeakSet: WeakSetConstructor;
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror