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

Each type is auto bound #22

Open
bssergy opened this issue Mar 4, 2018 · 1 comment
Open

Each type is auto bound #22

bssergy opened this issue Mar 4, 2018 · 1 comment

Comments

@bssergy
Copy link

bssergy commented Mar 4, 2018

Currently, if we didn't bind type, it will be bound on get method:

    static get(source: Function) {
        const config: ConfigImpl = <ConfigImpl>IoCContainer.bind(source);
        if (!config.iocprovider) {
            config.to(<FunctionConstructor>config.source);
        }
        return config.getInstance();
    }

But I want to return undefined if I forgot to bind a class (i.e. for unit tests). Could you fix to don't use bind() method in get() method()? I don't want to bind if I need just get type.

@thiagobustamante
Copy link
Owner

I think we can create some configuration option to the Container to enable this behavior you want. I can not just change it because it would break a lot of code. In addition, auto bind is a nice feature that can reduce the configuration in many cases.

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

No branches or pull requests

2 participants