diff --git a/libs/core/src/lib/di/decorators/inject.ts b/libs/core/src/lib/di/decorators/inject.ts index 1908474..2bf5884 100644 --- a/libs/core/src/lib/di/decorators/inject.ts +++ b/libs/core/src/lib/di/decorators/inject.ts @@ -9,6 +9,5 @@ export function Inject(token: Token) { target, `index-${index}` ); - return target; }; } diff --git a/libs/core/src/lib/di/decorators/injectable.ts b/libs/core/src/lib/di/decorators/injectable.ts index 49dc6bd..351943c 100644 --- a/libs/core/src/lib/di/decorators/injectable.ts +++ b/libs/core/src/lib/di/decorators/injectable.ts @@ -4,6 +4,5 @@ export function Injectable() { return function (target: T) { // o target, neste caso, é a classe que está sendo decorada. Reflect.defineMetadata(INJECTABLE_METADATA_KEY, true, target); - return target; }; } diff --git a/libs/core/src/lib/di/injector.spec.ts b/libs/core/src/lib/di/injector.spec.ts index ebc4b91..afc7fc8 100644 --- a/libs/core/src/lib/di/injector.spec.ts +++ b/libs/core/src/lib/di/injector.spec.ts @@ -15,7 +15,7 @@ const API_TOKEN = new InjectionToken('api.config'); abstract class Repository { protected api: string; - constructor(config: ApiConfig) { + protected constructor(config: ApiConfig) { this.api = config.url; } @@ -34,7 +34,7 @@ class DataRepository extends Repository { } abstract class Presenter { - constructor(public repository: Repository) {} + protected constructor(public repository: Repository) {} abstract getAll(): Promise; } @@ -64,7 +64,7 @@ describe('Injector', () => { provide: Presenter, useFactory: (repo: Repository) => new UiPresenter(repo), deps: [Repository], - } + }, ]); }); @@ -73,7 +73,7 @@ describe('Injector', () => { }); it('should return config object when asking api token', () => { - const config = injector.get(API_TOKEN); + const config = injector.get(API_TOKEN); expect(config).toStrictEqual({ url: 'https://api.clean-architecture.design', }); diff --git a/libs/core/src/lib/di/injector.ts b/libs/core/src/lib/di/injector.ts index 715e239..884263f 100644 --- a/libs/core/src/lib/di/injector.ts +++ b/libs/core/src/lib/di/injector.ts @@ -30,7 +30,7 @@ export class Injector { this.providers.set(provider.provide, provider); } - static create(providers: Provider[]) { + static create(providers: Provider[]) { if (!Injector.instance) { Injector.instance = new Injector(providers); }