Skip to content

Inject from multiple interfaces to singleton #53

@alebianco

Description

@alebianco

Considering the class

class A implements IOne implements ITwo {
...
}

With the following mapping:

injector.map(IOne).toSingleton(A);
injector.map(ITwo).toSingleton(A);

I will get two separate instances of class A used for the respective injection points (at least in JS).
I would have expected to have one single instance to be provided whenever one of the interfaces is requested.

I can easily switch to a toValue() type of mapping to solve my case, I was just wondering if this is the expected behaviour and my assumption is totally wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions