diff --git a/blueprints/service/files/__root__/__path__/__name__.ts b/blueprints/service/files/__root__/__path__/__name__.ts index 6f7a5e9baa4..d1685868023 100644 --- a/blueprints/service/files/__root__/__path__/__name__.ts +++ b/blueprints/service/files/__root__/__path__/__name__.ts @@ -1,3 +1,13 @@ import Service from '@ember/service'; export default class <%= classifiedModuleName %>Service extends Service {} + +// Don't remove this declaration: this is what enables TypeScript to resolve +// this service using `Owner.lookup('service:<%= dasherizedModuleName %>')`, as well +// as to check when you pass the service name as an argument to the decorator, +// like `@service('<%= dasherizedModuleName %>') declare altName: <%= classifiedModuleName %>Service;`. +declare module '@ember/service' { + interface Registry { + '<%= dasherizedModuleName %>': <%= classifiedModuleName %>Service; + } +}