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

docs: include additional interfaces to docs #6391

Merged

Conversation

jakovljevic-mladen
Copy link
Member

Description:
These types are exported so they can be included to the docs. I was thinking about where to include them, to src/index.ts or src/operators/index.ts, but I chose src/index.ts. The reason is that on the API list page, we want to add exported interface to the index section, rather than to the operators section, like this:

image

Another note: I added TimeoutInfo to exports because TimeoutConfig is now being exported and it's got with property that uses TimeoutInfo as a callback property.

Related issue (if exists):
Somewhat #6247 and a related comment.

@@ -61,9 +61,10 @@ export const defaultThrottleConfig: ThrottleConfig = {
*/
export function throttle<T>(
durationSelector: (value: T) => ObservableInput<any>,
{ leading, trailing }: ThrottleConfig = defaultThrottleConfig
config: ThrottleConfig = defaultThrottleConfig
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is added just because we could have a better documentation. Instead of this:

image

we can have this:

image

src/index.ts Outdated
@@ -95,6 +95,12 @@ export { NEVER } from './internal/observable/never';

/* Types */
export * from './internal/types';
export { ConnectConfig } from './internal/operators/connect';
Copy link
Member

Choose a reason for hiding this comment

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

While I think it makes sense that you put these here, it's probably better just to have them next to the operators they're with. Just to help show the relationship a little more clearly.

Copy link
Member Author

Choose a reason for hiding this comment

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

@benlesh, since #6488 has been merged to master, I think it would be wise to move exported interfaces back to this file and keep them exported only here.
The first reason is to avoid duplication - we don't want to export stuff in two interfaces (also, dgeni tools don't like duplicated stuff; also duplication is hard to maintain - what if a new interface is added, would a creator of that interface know that it should be added to both files?).
The second reason, if they would remain in /src/operators/index.ts file: that file will most probably be removed, so we want to have all exported interfaces in one place before removal so we don't remove exported interfaces accidentally.
Please let me know your thoughts on this. Thanks.

): MonoTypeOperatorFunction<T> {
return operate((source, subscriber) => {
const { leading, trailing } = config;
Copy link
Member

Choose a reason for hiding this comment

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

interesting. Was this change necessary for documentation reasons? That's sort of bananas.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, please take a look at this comment.

@jakovljevic-mladen
Copy link
Member Author

jakovljevic-mladen commented May 25, 2021

Included new groupBy interfaces. They had to be exported though... IMO, it makes sense to export them, that way they could be reused:

const options: GroupByOptionsWithElement<string, string, string> = {
  element: value => value.trim()
};
const grouped = groupBy(val => val, options);
const groupedLowerCase = groupBy(val => val.toLowerCase(), options);

Copy link
Member

@niklas-wortmann niklas-wortmann left a comment

Choose a reason for hiding this comment

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

LGTM but I would like someone else from the team to have a look to make sure I am not missing something

@jakovljevic-mladen
Copy link
Member Author

LGTM but I would like someone else from the team to have a look to make sure I am not missing something

Thanks @niklas-wortmann. I'm still waiting for @benlesh to confirm this.

@benlesh benlesh merged commit 5e78bc4 into ReactiveX:master Dec 27, 2021
@jakovljevic-mladen jakovljevic-mladen deleted the export_additional_interfaces branch December 27, 2021 21:03
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.

None yet

3 participants