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

Type error for getOwner #645

Closed
josemarluedke opened this issue Jan 26, 2022 · 3 comments · Fixed by #648
Closed

Type error for getOwner #645

josemarluedke opened this issue Jan 26, 2022 · 3 comments · Fixed by #648

Comments

@josemarluedke
Copy link
Contributor

When using v4 of @types/ember__application, we get error because getOwner now returns unknown.

../../node_modules/ember-basic-dropdown/addon/components/basic-dropdown.ts:318:18 - error TS2571: Object is of type 'unknown'.

318     let config = getOwner(this).resolveRegistration('config:environment');
                     ~~~~~~~~~~~~~~
Found 1 error.

I suggest moving to ember-get-config.

@cibernox
Copy link
Owner

Good point. I'm a bit short of time lately tho, do you reckon you can make a PR using ember-get-config?

@bertdeblock
Copy link
Contributor

I have very little TS experience, so forgive my ignorance, but isn't there another TS specific way this can be resolved that doesn't affect non TS users? I don't think using ember-get-config is a great alternative to the lookup we had before, my app's config is now included 3 times in the final build (see mansona/ember-get-config#39) and ember-get-config v1 also gets the config at runtime from a different location.

@bertdeblock
Copy link
Contributor

It seems this can be solved in TS land without switching to ember-get-config:
https://discord.com/channels/480462759797063690/484421406659182603/964057832838291486

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 a pull request may close this issue.

3 participants