Skip to content

Commit 259e483

Browse files
committed
Fix HashMap and HashSet iterator types to be MapIterator and SetIterator to be assignment-compatible with native ReadonlyMap and ReadonlySet types
1 parent 48cc43c commit 259e483

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/hashMap.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,19 @@ export class HashMap<K, V> implements ReadonlyMap<K, V> {
146146
}
147147
}
148148

149-
keys(): IterableIterator<K> {
149+
keys(): MapIterator<K> {
150150
return this._map.keys();
151151
}
152152

153-
values(): IterableIterator<V> {
153+
values(): MapIterator<V> {
154154
return this._map.values();
155155
}
156156

157-
entries(): IterableIterator<[K, V]> {
157+
entries(): MapIterator<[K, V]> {
158158
return this._map.entries();
159159
}
160160

161-
[Symbol.iterator](): IterableIterator<[K, V]> {
161+
[Symbol.iterator](): MapIterator<[K, V]> {
162162
return this.entries();
163163
}
164164
}
@@ -214,21 +214,21 @@ export class HashSet<K> implements ReadonlyHashSet<K> {
214214
this._map.forEach((_value, key) => callback(key, key, this));
215215
}
216216

217-
keys(): IterableIterator<K> {
217+
keys(): SetIterator<K> {
218218
return this._map.keys();
219219
}
220220

221-
values(): IterableIterator<K> {
221+
values(): SetIterator<K> {
222222
return this._map.keys();
223223
}
224224

225-
*entries(): IterableIterator<[K, K]> {
225+
*entries(): SetIterator<[K, K]> {
226226
for (const key of this.keys()) {
227227
yield [key, key];
228228
}
229229
}
230230

231-
[Symbol.iterator](): IterableIterator<K> {
231+
[Symbol.iterator](): SetIterator<K> {
232232
return this._map.keys();
233233
}
234234
}

0 commit comments

Comments
 (0)