Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
This repository was archived by the owner on Mar 25, 2021. It is now read-only.

Is @asuka/di has many breaking changes from v0.3.3 to v0.3.4? #535

@TIS-OMiddle

Description

@TIS-OMiddle

d96b65e#diff-b219ef22b92d2ebf9ffe305f35b9bd96

I notice this commit remove the InjectableConfig param from Injectable , and InjectableFactory has been removed.

The example code in README.md isn't work now:

import { Inject, InjectionToken, Injectable, InjectableFactory, ValueProvider } from '@asuka/di'
import Axios from 'axios'

const token = new InjectionToken<Axios>('Axios client')

const provider: ValueProvider = {
  provide: token,
  useValue: Axios,
}

@Injectable({
  providers: [provider],
})
class HttpClient {
  constructor(@Inject(token) public axios: Axios) { }
}

const client = InjectableFactory.getInstance(HttpClient)
expect(client).to.be.instanceof(HttpClient)
expect(client.axios).to.equal(Axios)

I have to use rootInjector.addProviders to replace any InjectableConfig used in @Injectable now?

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