diff --git a/types/ember-feature-flags/tsconfig.json b/types/ember-feature-flags/tsconfig.json index 966e80a2ba..54f7acecb3 100644 --- a/types/ember-feature-flags/tsconfig.json +++ b/types/ember-feature-flags/tsconfig.json @@ -14,6 +14,7 @@ "../" ], "paths": { + "@ember/service": ["ember__service"], "@ember/object": ["ember__object"], "@ember/object/*": ["ember__object/*"] }, diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 127898133a..594e2e2fcc 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -28,6 +28,7 @@ /// /// /// +/// declare module 'ember' { import { @@ -48,6 +49,8 @@ declare module 'ember' { import { Registry as ServiceRegistry } from '@ember/service'; import { Registry as ControllerRegistry } from '@ember/controller'; import * as EmberStringNs from '@ember/string'; + // tslint:disable-next-line:no-duplicate-imports + import * as EmberServiceNs from '@ember/service'; import * as EmberPolyfillsNs from '@ember/polyfills'; import * as EmberUtilsNs from '@ember/utils'; import * as EmberRunloopNs from '@ember/runloop'; @@ -464,14 +467,7 @@ declare module 'ember' { function controller( name: K ): ComputedProperty; - /** - * Creates a property that lazily looks up a service in the container. There - * are no restrictions as to what objects a service can be injected into. - */ - function service(): ComputedProperty; - function service( - name: K - ): ComputedProperty; + const service: typeof EmberServiceNs.inject; } namespace ENV { const EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; @@ -634,17 +630,6 @@ declare module 'ember' { export default Ember; } -declare module '@ember/service' { - import Ember from 'ember'; - export default class Service extends Ember.Service { } - export const inject: typeof Ember.inject.service; - - // A type registry for Ember `Service`s. Meant to be declaration-merged so - // string lookups resolve to the correct type. - // tslint:disable-next-line:no-empty-interface - interface Registry {} -} - declare module 'htmlbars-inline-precompile' { interface TemplateFactory { __htmlbars_inline_precompile_template_factory: any; diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index 49d680e46b..8a2cec5578 100755 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -19,6 +19,7 @@ "@ember/engine": ["ember__engine"], "@ember/engine/*": ["ember__engine/*"], "@ember/error": ["ember__error"], + "@ember/service": ["ember__service"], "@ember/utils": ["ember__utils"], "@ember/utils/*": ["ember__utils/*"], "@ember/array": ["ember__array"], diff --git a/types/ember__routing/tsconfig.json b/types/ember__routing/tsconfig.json index 1183e15063..a3f936580a 100644 --- a/types/ember__routing/tsconfig.json +++ b/types/ember__routing/tsconfig.json @@ -15,6 +15,7 @@ "../" ], "paths": { + "@ember/service": ["ember__service"], "@ember/object": ["ember__object"], "@ember/object/*": ["ember__object/*"], "@ember/array": ["ember__array"], diff --git a/types/ember__service/index.d.ts b/types/ember__service/index.d.ts index fa5d687441..4d89a87d01 100644 --- a/types/ember__service/index.d.ts +++ b/types/ember__service/index.d.ts @@ -4,10 +4,18 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import Ember from 'ember'; +import EmberObject from '@ember/object'; +import ComputedProperty from '@ember/object/computed'; -export default class Service extends Ember.Service { } -export const inject: typeof Ember.inject.service; +export default class Service extends EmberObject {} +/** + * Creates a property that lazily looks up a service in the container. There + * are no restrictions as to what objects a service can be injected into. + */ +export function inject(): ComputedProperty; +export function inject( + name: K +): ComputedProperty; // A type registry for Ember `Service`s. Meant to be declaration-merged so // string lookups resolve to the correct type.