@types/ember__service
TypeScript icon, indicating that this package has built-in type declarations

4.0.9 • Public • Published

Installation

npm install --save @types/ember__service

Summary

This package contains type definitions for @ember/service (https://emberjs.com/api/ember/4.0/modules/@ember%2Fservice).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ember__service.

index.d.ts

import EmberObject from "@ember/object";
import ComputedProperty from "@ember/object/computed";

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>; // @inject() foo, foo: inject()
export function inject(target: object, propertyKey: string | symbol): void; // @inject foo
export function inject<K extends keyof Registry>(name: K): ComputedProperty<Registry[K]>; // @inject('store') foo      @inject() foo

/**
 * 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 service(): ComputedProperty<Service>; // @service() foo, foo: service()
export function service(target: object, propertyKey: string | symbol): void; // @service foo
export function service<K extends keyof Registry>(name: K): ComputedProperty<Registry[K]>; // @service('store') foo      @service() foo

// A type registry for Ember `Service`s. Meant to be declaration-merged so
// string lookups resolve to the correct type.
/* eslint-disable @definitelytyped/strict-export-declare-modifiers */
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Registry extends Record<string, Service> {}

declare module "@ember/owner" {
    interface DIRegistry {
        service: Registry;
    }
}

Additional Details

Credits

These definitions were written by Krystan HuffMenne, James C. Davis, and Peter Wagenet.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/ember__service

Weekly Downloads

56,656

Version

4.0.9

License

MIT

Unpacked Size

6.14 kB

Total Files

5

Last publish

Collaborators

  • types