[ember] @ember/service as source of types, ember as re-export

This commit is contained in:
Mike North 2018-09-20 10:50:24 -07:00
parent 20d6cdb189
commit 479132fc56
5 changed files with 18 additions and 22 deletions

View File

@ -14,6 +14,7 @@
"../"
],
"paths": {
"@ember/service": ["ember__service"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},

View File

@ -28,6 +28,7 @@
/// <reference types="ember__routing" />
/// <reference types="ember__application" />
/// <reference types="ember__test" />
/// <reference types="ember__service" />
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<K extends keyof ControllerRegistry>(
name: K
): ComputedProperty<ControllerRegistry[K]>;
/**
* 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<Ember.Service>;
function service<K extends keyof ServiceRegistry>(
name: K
): ComputedProperty<ServiceRegistry[K]>;
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;

View File

@ -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"],

View File

@ -15,6 +15,7 @@
"../"
],
"paths": {
"@ember/service": ["ember__service"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/array": ["ember__array"],

View File

@ -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<Service>;
export function inject<K extends keyof Registry>(
name: K
): ComputedProperty<Registry[K]>;
// A type registry for Ember `Service`s. Meant to be declaration-merged so
// string lookups resolve to the correct type.