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

chore(typings): add typings for buffer and window based methods #1311

Closed

Conversation

david-driscoll
Copy link
Member

will probably need a rebase after #1292

@@ -23,6 +23,10 @@ export function buffer<T>(closingNotifier: Observable<any>): Observable<T[]> {
return this.lift(new BufferOperator<T>(closingNotifier));
}

export interface BufferSignature<T> {
(closingNotifier: Observable<any>): Observable<T[]>;
Copy link
Member Author

Choose a reason for hiding this comment

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

closingNotifier calls through to subscribeToResult, so technically this could be ObservableInput<T>. That doesn't really make sense for the more finite values from Promise<T>, Iterable<T> or Array<T>. So I think the best option is to explicitly leave these as just 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.

I think this is related to #1246. Probably we want to support return values other than observable - but I'd like to take care it as separate changes set include type update / test cases to ensure its behavior if necessary.

return this.lift(new BufferCountOperator<T>(bufferSize, startBufferEvery));
}

export interface BufferCountSignature<T> {
Copy link
Member

Choose a reason for hiding this comment

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

Compare to previous type definitions having n-number of param (combinelatest, etcs) these kind of operators have single signature only. Is it necessarily required to export signature then import in coreoperators?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly yes because we can't use typeof bufferCount, because bufferCount is a function that form of casting isn't supported.

Copy link
Member

Choose a reason for hiding this comment

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

OK, got point. Thanks for clarification.

Copy link
Contributor

Choose a reason for hiding this comment

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

One way to work around extra import is to use interface merging: export interface bufferCount. Now no extra import is required for BufferSignature, bufferCount acts as both function and signature. The benefit is marginal however.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I don't think this is serious issue need to be addressed. Mostly curious question.

@kwonoj
Copy link
Member

kwonoj commented Feb 6, 2016

Change looks good to me, (need to be rebased though)

@david-driscoll
Copy link
Member Author

done.

@kwonoj
Copy link
Member

kwonoj commented Feb 9, 2016

Merged with 51add30, thanks @david-driscoll .

@kwonoj kwonoj closed this Feb 9, 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.

None yet

3 participants