• A class decorator that encapsulates injectable properties

    Type Parameters

    • T extends Class<object>

      Type of the annotated class

    Parameters

    • container: Record<string, T[]> = defaultContainer

      Object that stores injectables

    Returns ClassDecorator<T>

    Remarks

    @Config defines values that will be available for injection

    @Config encapsulates @Property annotations. @Property takes a string as an argument and injects the returned value of the method using that string

    Properties may also use other properties in the config as long as they are declared in order

    Example

    import { Config } from "@fork-git-it/annotatedjs";

    @Config()
    export class ExampleConfig {
    @Property("Injected")
    getInjected(): unknown {
    // return some value to be injected
    }

    @Property("AnotherInjected")
    getAnotherInjected(): unknown {
    this.getInjected(); // will return singleton
    // return value to be injected
    }
    }

Generated using TypeDoc