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(Observable): align type definition of subscriber with Observable #2196

Merged
merged 1 commit into from
Jan 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/operators/groupBy-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ describe('Observable.prototype.groupBy', () => {
observer.complete();
}).groupBy(
(x: number) => x % 2,
(x: string) => x + '!'
(x: number) => x + '!'
);

expect(result instanceof MyCustomObservable).to.be.true;
Expand Down
4 changes: 2 additions & 2 deletions src/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Observable<T> implements Subscribable<T> {
* can be `next`ed, or an `error` method can be called to raise an error, or
* `complete` can be called to notify of a successful completion.
*/
constructor(subscribe?: <R>(this: Observable<T>, subscriber: Subscriber<R>) => TeardownLogic) {
constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic) {
Copy link
Member

Choose a reason for hiding this comment

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

I've suspected this could be troublesome at some point, but I'm sure I forgot about just after I saw it.

if (subscribe) {
this._subscribe = subscribe;
}
Expand All @@ -53,7 +53,7 @@ export class Observable<T> implements Subscribable<T> {
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
* @return {Observable} a new cold observable
*/
static create: Function = <T>(subscribe?: <R>(subscriber: Subscriber<R>) => TeardownLogic) => {
static create: Function = <T>(subscribe?: (subscriber: Subscriber<T>) => TeardownLogic) => {
return new Observable<T>(subscribe);
};

Expand Down