diff --git a/package.json b/package.json index 8549210..969e9f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@snap/ts-inject", - "version": "0.3.1", + "version": "0.3.2", "description": "100% typesafe dependency injection framework for TypeScript projects", "license": "MIT", "author": "Snap Inc.", diff --git a/src/Container.ts b/src/Container.ts index a96d7c6..87ad6cb 100644 --- a/src/Container.ts +++ b/src/Container.ts @@ -421,7 +421,8 @@ export class Container { providesClass = []>( token: Token, cls: InjectableClass - ) => this.providesService(ClassInjectable(token, cls)); + ): Container> => + this.providesService(ClassInjectable(token, cls)) as Container>; /** * Registers a static value as a service in the container. This method is ideal for services that do not @@ -433,8 +434,10 @@ export class Container { * @returns A new Container instance that includes the provided service, allowing for chaining additional * `provides` calls. */ - providesValue = (token: Token, value: Service) => - this.providesService(Injectable(token, [], () => value)); + providesValue = ( + token: Token, + value: Service + ): Container> => this.providesService(Injectable(token, [], () => value)); /** * Appends a value to the array associated with a specified token in the current Container, then returns @@ -455,7 +458,7 @@ export class Container { appendValue = >( token: Token, value: Service - ) => this.providesService(ConcatInjectable(token, () => value)) as Container; + ): Container => this.providesService(ConcatInjectable(token, () => value)) as Container; /** * Appends an injectable class factory to the array associated with a specified token in the current Container, @@ -479,7 +482,7 @@ export class Container { >( token: Token, cls: InjectableClass - ) => + ): Container => this.providesService( ConcatInjectable(token, () => this.providesClass(token, cls).get(token)) ) as Container; @@ -507,7 +510,7 @@ export class Container { Service extends ArrayElement, >( fn: InjectableFunction - ) => + ): Container => this.providesService( ConcatInjectable(fn.token, () => this.providesService(fn).get(fn.token)) ) as Container;