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

feat(core): improve signature of operators regarding types #43

Merged
merged 1 commit into from
Jun 3, 2016

Conversation

staltz
Copy link
Owner

@staltz staltz commented Jun 3, 2016

This commit changes core operators to return either: (1) Stream only, (2) Stream or MemoryStream,
(3) MemoryStream only. Operators like fold() and startWith() now always return a MemoryStream, while
operators like map(), take(), and endWhen() return the same type that the source/instance stream
was. E.g. MemoryStream mapped will return a MemoryStream.

BREAKING CHANGE:
debug() now returns a MemoryStream if the input was also a MemoryStream.
endWhen() now returns a MemoryStream if the input was also a MemoryStream.
fold() now returns always a MemoryStream, not Stream.
imitate() only works on conventional Stream, will throw error on MemoryStream.
map() now returns a MemoryStream if the input was also a MemoryStream.
mapTo() now returns a MemoryStream if the input was also a MemoryStream.
replaceError() now returns a MemoryStream if the input was also a MemoryStream.
startWith() now returns always a MemoryStream, not Stream.
take() now returns a MemoryStream if the input was also a MemoryStream.

@TylorS

This commit changes core operators to return either: (1) Stream only, (2) Stream or MemoryStream,
(3) MemoryStream only. Operators like fold() and startWith() now always return a MemoryStream, while
operators like map(), take(), and endWhen() return the same type that the source/instance stream
was. E.g. MemoryStream mapped will return a MemoryStream.

BREAKING CHANGE:
debug() now returns a MemoryStream if the input was also a MemoryStream.
endWhen() now returns a MemoryStream if the input was also a MemoryStream.
fold() now returns always a MemoryStream, not Stream.
imitate() only works on conventional Stream, will throw error on
MemoryStream.
map() now returns a MemoryStream if the input was also a MemoryStream.
mapTo() now returns a MemoryStream if the input was also a MemoryStream.
replaceError() now returns a MemoryStream if the input was also a MemoryStream.
startWith() now returns always a MemoryStream, not Stream.
take() now returns a MemoryStream if the input was also a MemoryStream.
@@ -1046,6 +1046,10 @@ export class Stream<T> implements InternalListener<T> {
}
}

private ctor(): typeof Stream {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very clever! 👍

@TylorS
Copy link
Collaborator

TylorS commented Jun 3, 2016

LGTM

@staltz staltz merged commit 116e9f2 into master Jun 3, 2016
@staltz staltz deleted the returnMemoryStream branch June 3, 2016 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants