UNPKG

@types/ember__service

Version:
51 lines (41 loc) 2.31 kB
# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ember__service/index.d.ts) ````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 * Last updated: Tue, 16 Jan 2024 17:36:15 GMT * Dependencies: [@types/ember__object](https://npmjs.com/package/@types/ember__object) # Credits These definitions were written by [Krystan HuffMenne](https://github.com/gitKrystan), [James C. Davis](https://github.com/jamescdavis), and [Peter Wagenet](https://github.com/wagenet).