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

Property stub based type definition does not support parameter default value #660

Closed
kwonoj opened this issue Nov 5, 2015 · 3 comments · Fixed by #681
Closed

Property stub based type definition does not support parameter default value #660

kwonoj opened this issue Nov 5, 2015 · 3 comments · Fixed by #681

Comments

@kwonoj
Copy link
Member

kwonoj commented Nov 5, 2015

Some of operators allows default value if it's not specified like below,

function repeat<T>(count: number = -1);
function defaultIfEmpty<T, R>(defaultValue: R = null);

and Observable has property stub to create prototype in module like
repeat: <T>(count: number) => Observable<T>
default value for parameter is not allowed, end result causes typescript compiler complains without parameter.

Rx.Observable.of(42).defaultIfEmpty();
error TS2346: Supplied parameters do not match any signature of call target.

related with #608, and #643 for remove property based stubs.

@benlesh
Copy link
Member

benlesh commented Nov 9, 2015

repeat: (count: number) => Observable

It should probably just be repeat: <T>(count?: number) => Observable<T> in the stub, then.

? will make the difference, I think.

@kwonoj
Copy link
Member Author

kwonoj commented Nov 9, 2015

Yes, you're correct. Completely forgot it somehow even staring optional operators all time.

@kwonoj
Copy link
Member Author

kwonoj commented Nov 9, 2015

Will update PR and close this one.

kwonoj added a commit to kwonoj/rxjs that referenced this issue Nov 9, 2015
@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 a pull request may close this issue.

2 participants