Skip to content

Commit

Permalink
fix(transducers): minor TS3.1 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 30, 2018
1 parent 515e5ba commit 1ef2361
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/transducers/src/iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function* iterator<A, B>(xform: Transducer<A, B>, xs: Iterable<A>): Itera
* @param xs
*/
export function* iterator1<A, B>(xform: Transducer<A, B>, xs: Iterable<A>): IterableIterator<B> {
const reduce = (<Reducer<B, A>>xform([null, null, (acc, x) => (acc = x)]))[2];
const reduce = (<Reducer<B, A>>xform([null, null, (_, x) => x]))[2];
for (let x of xs) {
let y = reduce(<any>SEMAPHORE, x);
if (isReduced(y)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/interleave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { isReduced } from "../reduced";

export function interleave<A, B>(sep: B | (() => B)): Transducer<A, A | B>;
export function interleave<A, B>(sep: B | (() => B), src: Iterable<A>): IterableIterator<A | B>;
export function interleave<A, B>(sep: B | (() => B), src?: Iterable<A>): any {
export function interleave<A, B>(sep: any, src?: Iterable<A>): any {
return src ?
iterator(interleave(sep), src) :
(rfn: Reducer<any, A | B>) => {
const r = rfn[2];
const _sep = typeof sep === "function" ? sep : () => sep;
const _sep: () => B = typeof sep === "function" ? sep : () => sep;
return compR(rfn,
(acc, x: A) => {
acc = r(acc, _sep());
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/interpose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { isReduced } from "../reduced";

export function interpose<A, B>(sep: B | (() => B)): Transducer<A, A | B>;
export function interpose<A, B>(sep: B | (() => B), src: Iterable<A>): IterableIterator<A | B>;
export function interpose<A, B>(sep: B | (() => B), src?: Iterable<A>): any {
export function interpose<A, B>(sep: any, src?: Iterable<A>): any {
return src ?
iterator(interpose(sep), src) :
(rfn: Reducer<any, A | B>) => {
const r = rfn[2];
const _sep = typeof sep === "function" ? sep : () => sep;
const _sep: () => B = typeof sep === "function" ? sep : () => sep;
let first = true;
return compR(rfn,
(acc, x: A) => {
Expand Down

0 comments on commit 1ef2361

Please sign in to comment.