Skip to content

Commit

Permalink
fix(associative): add missing return type decls
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Mar 29, 2019
1 parent a2ace9f commit 1913bb4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions packages/associative/src/array-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class ArraySet<T> extends Set<T> implements IEquivSet<T> {
}

has(x: T) {
return this.get(x, SEMAPHORE) !== SEMAPHORE;
return this.get(x, <any>SEMAPHORE) !== <any>SEMAPHORE;
}

/**
Expand All @@ -90,7 +90,7 @@ export class ArraySet<T> extends Set<T> implements IEquivSet<T> {
* @param x
* @param notFound
*/
get(x: T, notFound?: any) {
get(x: T, notFound?: T): T | undefined {
const $this = __private.get(this);
const eq = $this.equiv;
const vals = $this.vals;
Expand Down Expand Up @@ -155,11 +155,11 @@ export class ArraySet<T> extends Set<T> implements IEquivSet<T> {
}
}

*keys() {
*keys(): IterableIterator<T> {
yield* __private.get(this).vals;
}

*values() {
*values(): IterableIterator<T> {
yield* this.keys();
}

Expand Down
10 changes: 5 additions & 5 deletions packages/associative/src/equiv-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class EquivMap<K, V> extends Map<K, V>
}
}

[Symbol.iterator]() {
[Symbol.iterator](): IterableIterator<Pair<K, V>> {
return this.entries();
}

Expand Down Expand Up @@ -148,7 +148,7 @@ export class EquivMap<K, V> extends Map<K, V>
}
}

get(key: K, notFound?: any) {
get(key: K, notFound?: V): V | undefined {
const $this = __private.get(this);
key = $this.keys.get(key, SEMAPHORE);
if (key !== <any>SEMAPHORE) {
Expand Down Expand Up @@ -180,15 +180,15 @@ export class EquivMap<K, V> extends Map<K, V>
return this;
}

entries() {
entries(): IterableIterator<Pair<K, V>> {
return __private.get(this).map.entries();
}

keys() {
keys(): IterableIterator<K> {
return __private.get(this).map.keys();
}

values() {
values(): IterableIterator<V> {
return __private.get(this).map.values();
}

Expand Down
10 changes: 5 additions & 5 deletions packages/associative/src/ll-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class LLSet<T> extends Set<T> implements IEquivSet<T> {
vals && this.into(vals);
}

*[Symbol.iterator]() {
*[Symbol.iterator](): IterableIterator<T> {
yield* __private.get(this).vals;
}

Expand Down Expand Up @@ -84,7 +84,7 @@ export class LLSet<T> extends Set<T> implements IEquivSet<T> {
}

has(x: T) {
return this.get(x, SEMAPHORE) !== SEMAPHORE;
return this.get(x, <any>SEMAPHORE) !== <any>SEMAPHORE;
}

/**
Expand All @@ -94,7 +94,7 @@ export class LLSet<T> extends Set<T> implements IEquivSet<T> {
* @param x
* @param notFound
*/
get(x: T, notFound?: any) {
get(x: T, notFound?: T): T | undefined {
const $this = __private.get(this);
const eq = $this.equiv;
let i = $this.vals.head;
Expand Down Expand Up @@ -162,11 +162,11 @@ export class LLSet<T> extends Set<T> implements IEquivSet<T> {
}
}

*keys() {
*keys(): IterableIterator<T> {
yield* __private.get(this).vals;
}

*values() {
*values(): IterableIterator<T> {
yield* this.keys();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/associative/src/sorted-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class SortedMap<K, V> extends Map<K, V> {
return node ? [node.k, node.v] : undefined;
}

get(k: K, notFound?: V) {
get(k: K, notFound?: V): V | undefined {
const node = this.findPredNode(k).next[0];
return node && __private.get(this).cmp(node.k, k) === 0
? node.v
Expand Down
2 changes: 1 addition & 1 deletion packages/associative/src/sorted-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class SortedSet<T> extends Set<T>
return __private.get(this).has(value);
}

get(value: T, notFound?: any) {
get(value: T, notFound?: T): T | undefined {
return __private.get(this).get(value, notFound);
}

Expand Down

0 comments on commit 1913bb4

Please sign in to comment.