-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Documentation] No documented public API for Owner
#19916
Comments
IMO it hardly matters whether people originally intended it to be public. It's definitely relied on too heavily for us to ever break it without a lengthy migration plan. There are 53 places in Ember itself that will likely blow up if anybody tries to
So I really don't think there's any meaningful sense in which we support owners that don't conform to type. (Unit tests of course can choose to stub only as much of the type as they actually need, but that's a given for all unit tests and doesn't really say anything about the underlying types.) |
For what it's worth, I totally agree with you, but: (a) that's true of a lot of internal APIs, and (b) that therefore would normally make it “intimate” rather than public by definition. Everyone in the Typed Ember team thinks the basic |
For next steps here – @ef4 my own take is that we should go ahead and call this interface (lightly modified to remove some of the type unsafety) public. If that needs an RFC, I will write it: it's like 300 words. |
Yes, I think the concrete next action here could be a PR updating the docs. |
I think we're all agreed that it should be public. It basically has to be since it is in the contractor for all EmberObject subclasses! |
We need to implement the actual Ember side of this, but initial support has landed for the types and docs via DefinitelyTyped now that RFC 821 is merged, so: progress is happening! I expect to open a PR landing the rest of the implementation details against Ember next week (after we land #20092). |
As briefly discussed in #19914, there is not (and to my knowledge has never been) a definition of the public API of the
Owner
as expected bygetOwner
andsetOwner
. The API docs specify onlyObject
as the type for the owner object returned bygetOwner
or expected as the second param tosetOwner
:getOwner
setOwner
Additionally, while the
getOwner
docs include a short snippet showing the use oflookup
, there is no further documentation anywhere in Ember's API docs (as far as I can tell) of what exactly anOwner
is.On #19914, @ef4 suggested that the types within Ember represent the intended public API:
ember.js/packages/@ember/-internals/owner/index.ts
Lines 30 to 39 in 6b77e9b
If that is true, we should:
Some context:
Past (verbal) discussions with various folks have never been conclusive here, so I’m opening this to get us as quickly as possible to an agreed-upon answer that we can document and publish—this is causing folks some pain as they upgrade to the v4 types. Earlier versions of the types returned
any
here, because they predated better tools likeunknown
, and in the absence of a publicly-documented API,unknown
(or perhaps the equally useless to end usersobject
) are the only options on offer.Typed Ember has always maintained a policy that we do not publish types on DefinitelyTyped which do not correspond to documented public API for Ember. We are absolutely not in the business of defining the public API for Ember! Rather, we are in the business of accurately representing it in the types.
The text was updated successfully, but these errors were encountered: