• A class accessor decorator that injects a property

    Type Parameters

    • T

      Type of the encapsulating class

    • K

      The annotated accessor's type

    Parameters

    • key: string | NewableFunction

      Unique key for the injectable value

    Returns ClassAccessorDecorator<T, K>

    Remarks

    @Inject is the annotation that allows for injection across classes

    It accepts two different types of arguments: a string or a class

    Example

    import { Inject, Service } from "@fork-git-it/annotatedjs";
    // import AnotherService

    @Service()
    export class ExampleService {
    @Inject("Property")
    private accessor injectedProp: unknown;

    @Inject(AnotherService)
    private accessor injectedService: AnotherService;
    }

Generated using TypeDoc