fix Iterator vs IterableIterator confusion

This commit is contained in:
Bruno Windels 2021-11-30 17:05:39 +01:00
parent de8995fa7e
commit 8c3ae57497
2 changed files with 3 additions and 3 deletions

View file

@ -35,7 +35,7 @@ export function defaultObserverWith<T>(overrides: { [key in keyof IListObserver<
return Object.assign(defaults, overrides); return Object.assign(defaults, overrides);
} }
export abstract class BaseObservableList<T> extends BaseObservable<IListObserver<T>> { export abstract class BaseObservableList<T> extends BaseObservable<IListObserver<T>> implements Iterable<T> {
emitReset() { emitReset() {
for(let h of this._handlers) { for(let h of this._handlers) {
h.onReset(this); h.onReset(this);
@ -69,6 +69,6 @@ export abstract class BaseObservableList<T> extends BaseObservable<IListObserver
} }
} }
abstract [Symbol.iterator](); abstract [Symbol.iterator](): Iterator<T>;
abstract get length(): number; abstract get length(): number;
} }

View file

@ -43,7 +43,7 @@ export class Range {
return range.start < this.end && this.start < range.end; return range.start < this.end && this.start < range.end;
} }
forEachInIterator<T>(it: IterableIterator<T>, callback: ((T, i: number) => void)) { forEachInIterator<T>(it: Iterator<T>, callback: ((T, i: number) => void)) {
let i = 0; let i = 0;
for (i = 0; i < this.start; i += 1) { for (i = 0; i < this.start; i += 1) {
it.next(); it.next();