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(typings): set map function parameter for Observable.from as optional #1334

Closed
wants to merge 1 commit into from
Closed

fix(typings): set map function parameter for Observable.from as optional #1334

wants to merge 1 commit into from

Conversation

mchmielarski
Copy link
Contributor

without this change typescript returns TS2346 error when we use Observable.from with one parameter.

I think that it will be nice if tests will be written in typescript because it will eliminate situations like this.

without this change typescript returns TS2346 error
when we use Observable.from with one parameter.

I think that it will be nice if tests will be written in typescript
because it will eliminate situations like this.
@@ -20,7 +20,7 @@ export class FromObservable<T> extends Observable<T> {
super(null);
}

static create<T>(ish: any, mapFnOrScheduler: Scheduler | ((x: any, y: number) => T), thisArg?: any, lastScheduler?: Scheduler): Observable<T> {
static create<T>(ish: any, mapFnOrScheduler?: Scheduler | ((x: any, y: number) => T), thisArg?: any, lastScheduler?: Scheduler): Observable<T> {
Copy link
Member

Choose a reason for hiding this comment

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

this makes sense for signature of generic from behavior. however in this case, does array-like observable need to check existence of mapFn in line 45? so far I remember arraylikeobservable's mapfn is required parameter. @justinwoo , is my understanding correct? or can we skip mapFn?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh, oops, mapFn should be optional. it's supposed to just use identity when not specified.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, thanks for clarification. So it seems PR's good :)

@kwonoj
Copy link
Member

kwonoj commented Feb 11, 2016

Merged with efa4dc3, thanks for catching this @mchmielarski (also @justinwoo for confirm this).

For testing, we're currently trying to put some effort if it's feasible to migrate current test cases into typescript to have type validation tests as you mentioned. It's not there yet though, it's something we'd like to have.

@kwonoj kwonoj closed this Feb 11, 2016
@lock
Copy link

lock bot commented Jun 7, 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 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants