-
Notifications
You must be signed in to change notification settings - Fork 99
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
getOwner(this)
returns unknown
type
#1471
Comments
Thanks for the report! The problem is that Ember’s actual public API here is underspecified. See discussion at emberjs/ember.js#19916. Once we have that resolved, we’ll update these types accordingly! |
Documenting a workaround here while I work on trying to get emberjs/ember.js#19916 unblocked: you can write a module extension like this in your types locally: declare module '@ember/application' {
interface Owner {
lookup(fullName: string, options?: LookupOptions): T | undefined;
factoryFor(fullName: string, options?: LookupOptions): Factory<unknown, unknown> | undefined;
factoryFor(fullName: string, options?: LookupOptions): Factory<unknown, unknown> | undefined;
buildChildEngineInstance(name: string, options?: EngineInstanceOptions): EngineInstance;
register(fullName: string, factory: Factory<T, C>, options?: object): void;
hasRegistration(name: string, options?: LookupOptions): boolean;
mountPoint?: string;
routable?: boolean;
}
export function getOwner(object: unknown): Owner;
} (This is basically a safer version of the types over in Ember.) |
I believe this issue has been resolved as of Ember 4.10. Hurray! :) |
Also as of the stable types. |
Which package(s) does this problem pertain to?
In v4 of the types,
getOwner(this)
returns anunknown
type. As far as I can tell that is not really correct, it should either return some type ofOwner
or just anApplicationInstance
or something along this line?The text was updated successfully, but these errors were encountered: