Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(reduce): change order of reduce overload type definitions #2523

Merged
merged 2 commits into from
Jun 14, 2017

Conversation

PrimalZed
Copy link
Contributor

Description: Update overload type definitions of operator reduce so returning type T takes precedence over returning type T[].

Related issue (if exists): #2519

Returning type T takes precedence over returning type T[].
Copy link
Member

@kwonoj kwonoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably we may need test cases for this to check if there's no regressions / validate this changes fixes issue. what do you think? @david-driscoll

@david-driscoll
Copy link
Member

Yeah we should have two tests. The ones from #2519 should be sufficient. Make sure you assign them to a specific type so that the types match both sides.

const o1: Observable<number[]> = Observable.of([0, 1, 2, 3], [4, 5, 6, 7])
    .reduce((acc, value) => acc.concat(value), [])
    .map(numbers => numbers.map(n => n++))

const o2: Observable<number[]> = Observable.of(0, 1, 2, 3, 4, 5, 6, 7)
    .reduce((acc, value) => { acc.push(value); return acc; }, [])
    .map(numbers => numbers.map(n => n++))

Copy link
Member

@david-driscoll david-driscoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we get a the typings tests in this is gtg

@PrimalZed
Copy link
Contributor Author

Sorry, I rarely do pull requests on github. I'll check to see how testing works in other pull requests and get this updated.

@rxjs-bot
Copy link

rxjs-bot commented Apr 4, 2017

Warnings
⚠️ commit message does not follows conventional change log (1)

(1) : RxJS uses conventional change log to generate changelog automatically. It seems some of commit messages are not following those, please check contributing guideline and update commit messages.

Generated by 🚫 dangerJS

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.687% when pulling e9be1f4 on PrimalZed:master into bc1e1e5 on ReactiveX:master.

Add tests for reducing T[] to T[] (e.g. concatenating arrays into one array) and for reducing T to T[] (e.g. pushing items into an array).
@PrimalZed PrimalZed changed the title Change order of reduce overload type definitions fix(reduce): change order of reduce overload type definitions Apr 4, 2017
@coveralls
Copy link

coveralls commented Apr 4, 2017

Coverage Status

Coverage remained the same at 97.687% when pulling 5ddb0be on PrimalZed:master into bc1e1e5 on ReactiveX:master.

Copy link
Member

@david-driscoll david-driscoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @kwonoj ?

@kwonoj kwonoj added the TS Issues and PRs related purely to TypeScript issues label May 2, 2017
@kwonoj
Copy link
Member

kwonoj commented May 2, 2017

What'd be release for this? /cc @david-driscoll

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
TS Issues and PRs related purely to TypeScript issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants