@@ -27,3 +27,80 @@ interface MapConstructor {
2727 keySelector : ( item : T , index : number ) => K ,
2828 ) : Map < K , T [ ] > ;
2929}
30+
31+ interface ReadonlySetLike < T > {
32+ /**
33+ * Despite its name, returns an iterator of the values in the set-like.
34+ */
35+ keys ( ) : Iterator < T > ;
36+ /**
37+ * @returns a boolean indicating whether an element with the specified value exists in the set-like or not.
38+ */
39+ has ( value : T ) : boolean ;
40+ /**
41+ * @returns the number of (unique) elements in the set-like.
42+ */
43+ readonly size : number ;
44+ }
45+
46+ interface Set < T > {
47+ /**
48+ * @returns a new Set containing all the elements in this Set and also all the elements in the argument.
49+ */
50+ union < U > ( other : ReadonlySetLike < U > ) : Set < T | U > ;
51+ /**
52+ * @returns a new Set containing all the elements which are both in this Set and in the argument.
53+ */
54+ intersection < U > ( other : ReadonlySetLike < U > ) : Set < T & U > ;
55+ /**
56+ * @returns a new Set containing all the elements in this Set which are not also in the argument.
57+ */
58+ difference < U > ( other : ReadonlySetLike < U > ) : Set < T > ;
59+ /**
60+ * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both.
61+ */
62+ symmetricDifference < U > ( other : ReadonlySetLike < U > ) : Set < T | U > ;
63+ /**
64+ * @returns a boolean indicating whether all the elements in this Set are also in the argument.
65+ */
66+ isSubsetOf ( other : ReadonlySetLike < unknown > ) : boolean ;
67+ /**
68+ * @returns a boolean indicating whether all the elements in the argument are also in this Set.
69+ */
70+ isSupersetOf ( other : ReadonlySetLike < unknown > ) : boolean ;
71+ /**
72+ * @returns a boolean indicating whether this Set has no elements in common with the argument.
73+ */
74+ isDisjointFrom ( other : ReadonlySetLike < unknown > ) : boolean ;
75+ }
76+
77+ interface ReadonlySet < T > {
78+ /**
79+ * @returns a new Set containing all the elements in this Set and also all the elements in the argument.
80+ */
81+ union < U > ( other : ReadonlySetLike < U > ) : Set < T | U > ;
82+ /**
83+ * @returns a new Set containing all the elements which are both in this Set and in the argument.
84+ */
85+ intersection < U > ( other : ReadonlySetLike < U > ) : Set < T & U > ;
86+ /**
87+ * @returns a new Set containing all the elements in this Set which are not also in the argument.
88+ */
89+ difference < U > ( other : ReadonlySetLike < U > ) : Set < T > ;
90+ /**
91+ * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both.
92+ */
93+ symmetricDifference < U > ( other : ReadonlySetLike < U > ) : Set < T | U > ;
94+ /**
95+ * @returns a boolean indicating whether all the elements in this Set are also in the argument.
96+ */
97+ isSubsetOf ( other : ReadonlySetLike < unknown > ) : boolean ;
98+ /**
99+ * @returns a boolean indicating whether all the elements in the argument are also in this Set.
100+ */
101+ isSupersetOf ( other : ReadonlySetLike < unknown > ) : boolean ;
102+ /**
103+ * @returns a boolean indicating whether this Set has no elements in common with the argument.
104+ */
105+ isDisjointFrom ( other : ReadonlySetLike < unknown > ) : boolean ;
106+ }
0 commit comments