Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing required @injectable annotation in: Anonymous function: function (target) #741

Closed
mnifakram opened this issue Jan 4, 2018 · 1 comment

Comments

@mnifakram
Copy link

I'm not sure whether this is related to #297, #262, #524 but all of them got this issue as a result of an inheritance.

I was trying to integrate inversify-inject-decorators to be able to call the constructor but the property doesn't get injected properly (if I did understand the error message well).

Can you please tell me what I'm doing wrong?
https://github.com/mnifakram/inversify-issue
or if you have c9 account => https://ide.c9.io/akrammnif/ioc-test

Stack trace

/home/ubuntu/workspace/node_modules/inversify/lib/planning/reflection_utils.js:19
        throw new Error(msg);
              ^
Error: Missing required @injectable annotation in: Anonymous function: function (target) {
        if (Reflect.hasOwnMetadata(METADATA_KEY.PARAM_TYPES, target)) {
            throw new Error(ERRORS_MSGS.DUPLICATED_INJECTABLE_DECORATOR);
        }
        var types = Reflect.getMetadata(METADATA_KEY.DESIGN_PARAM_TYPES, target) || [];
        Reflect.defineMetadata(METADATA_KEY.PARAM_TYPES, types, target);
        return target;
    }.
    at getTargets (/home/ubuntu/workspace/node_modules/inversify/lib/planning/reflection_utils.js:19:15)
    at Object.getDependencies (/home/ubuntu/workspace/node_modules/inversify/lib/planning/reflection_utils.js:10:19)
    at /home/ubuntu/workspace/node_modules/inversify/lib/planning/planner.js:106:51
    at Array.forEach (native)
    at _createSubRequests (/home/ubuntu/workspace/node_modules/inversify/lib/planning/planner.js:94:20)
    at Object.plan (/home/ubuntu/workspace/node_modules/inversify/lib/planning/planner.js:129:9)
    at /home/ubuntu/workspace/node_modules/inversify/lib/container/container.js:243:37
    at Container._get (/home/ubuntu/workspace/node_modules/inversify/lib/container/container.js:236:44)
    at Container.get (/home/ubuntu/workspace/node_modules/inversify/lib/container/container.js:195:21)
    at resolve (/home/ubuntu/workspace/node_modules/inversify-inject-decorators/lib/decorators.js:25:34)
@mnifakram
Copy link
Author

sorry it was my mistake used @injectable instead of @injectable()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant