@kayahr/harmless
    Preparing search index...

    Function component

    • Attaches explicit dependency injection metadata to a function component.

      The returned component is the original function, so unit tests can still call it directly with explicit dependency arguments.

      Type Parameters

      • C extends (props: any, ...dependencies: any[]) => Element

        The function component type.

      Parameters

      • component: C

        The function component.

      • dependencies: NoInfer

        The dependency qualifiers matching the component parameters after the props argument.

      Returns C

      The original function component.

    • Attaches explicit dependency injection metadata to a class component.

      The returned component is the original constructor, so unit tests can still instantiate it directly with explicit dependency arguments.

      Type Parameters

      • C extends new (props: any, ...dependencies: any[]) => ComponentInstance

        The class component type.

      Parameters

      • component: C

        The class component.

      • dependencies: NoInfer

        The dependency qualifiers matching the constructor parameters after the props argument.

      Returns C

      The original class component.

    • Creates an ECMAScript class decorator attaching dependency metadata to a class component.

      Type Parameters

      • const D extends readonly NoInfer[]

        The dependency metadata tuple.

      Parameters

      • dependencies: [...D[]]

        The dependency qualifiers matching the constructor parameters after the props argument.

      Returns <C extends new (props: any, ...dependencies: any[]) => ComponentInstance>(
          value: C,
          context: ClassDecoratorContext<C>,
      ) => void

      The class decorator.