-
Notifications
You must be signed in to change notification settings - Fork 3k
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: use @internal and _ for internals; remove protected modifiers #6215
Conversation
Ugghhhhh.... This sucks. I see what you're doing, I agree with what you're doing. And I hate it. All at the same time. Shouldn't the Also, #3544 was a long time ago. Are we sure this is still an issue? |
There is a TS thing that relates to not emitting internals, but it's not supposed to be used and using causes problems.
Yeah, the TS Playground shows that it will be. A better solution - as you've noted before - would be to not export classes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with my other comment about observers
, specifically, we really need to think about this.
The problem with what I see here is we're renaming things (rather than just affecting their TypeScript visibility), which is a run-time breaking change.
For any JavaScript (non-TS) user, the API that they thought was theirs to use, isStopped
for example, is now suddenly _isStopped
. Which, to some degree is fine but we're going to need to document it.
Some part of me really wants to make sure that #3544 is even an issue in 2021, given that it was dealt with back in 2018. On the surface, this PR looks like we're moving the wrong direction, if we don't have that context.
I'm stupid, where is the playground? I don't see it. |
I feel like what I've learned from this is that |
|
As a more moderate maneuver, could we only rename the properties we had deprecated in 6.x, and deprecate the properties we hadn't renamed yet for v8? Then we can remove/rename those in v8 without as many issues as doing it right now. |
Sure. This PR rolls up several ideas. We can pick and choose. |
Just go all the way: OO is a joke. 😅 |
Another alternative: What if we keep the properties |
I found the comment that I'd remembered and, AFAICT, we should do this:
I'll look at making these changes. |
b43067c
to
7a2b384
Compare
7a2b384
to
316ba76
Compare
@@ -37,6 +37,7 @@ export class ConnectableObservable<T> extends Observable<T> { | |||
} | |||
} | |||
|
|||
/** @internal */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tagged _subscribe
as internal 'cause it was tagged in many other places and this was done as part of a search/replace thing. I've ignored the other protected members in this class 'cause the entire class is deprecated.
I wanted to double check that the |
Description:
Update: this PR now does what's listed in this comment.
This PR removes the @deprecated tags from public/protected internals in favour of using @internal tags along with a underscore prefix - the latter was already used extensively throughout the codebase, so this just makes things more consistent, IMO, and means that people looking at runtime objects in the console or debugger will see properties and methods that are adorned with underscores that scream "THESE ARE INTERNAL".
Personally, I find that using the @deprecated tag for internals just makes the RxJS source harder to work with - as many things are shown struck out in VS Code. IMO, using @internal - there is an ESLint rule that'll use that tag - and an underscore is more than enough to indicate to developers that something should not be relied upon or messed with.
I've not removed @deprecated from the
lift
API, that used to be public, albeit undocumented. And I've not removed it from the exportedOperator
andScheduler
types.This PR also removes the
protected
modifiers that were re-introduced in the v7 refactor/rewrite. This avoids the problem that was addressed in #3544 - which removed theprotected
modifiers. (TS Playground repro of the problem addressed in that issue here.) I've not removed them from types that are not exported - like the scheduler actions.Whether or not the removal of
protected
is the what ought to be done, IDK. I've removed it in case it was added without what was done in #3544 being considered. However, IMO, I think removing it - inline with what was done in #3544 - will be the least problematic option. ATM, in v7, thelift
API isprotected
and I think if it's left like that, problems are going to be effected, asObservable
is a type that's likely to be exported by user-land packages.Related issue (if exists): #5967 (kinda)