Skip to content

Commit

Permalink
fix(JSService): explicitly cast Service arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
freshgum-bubbles committed Jul 5, 2023
1 parent 43ab0dc commit df3dfd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/decorators/js-service.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function JSService<T extends ServiceWithDependencies<TDependencies>, TDep
constructor: T
): T;

export function JSService<T extends AnyConstructable>(
export function JSService<T extends ServiceWithDependencies<TDependencies>, TDependencies extends AnyServiceDependency[]>(
optionsOrDependencies: Omit<ServiceOptions<T>, 'dependencies'> | ServiceOptions<T> | AnyServiceDependency[],
dependenciesOrConstructor: AnyInjectIdentifier[] | T,
maybeConstructor?: T
Expand All @@ -78,7 +78,7 @@ export function JSService<T extends AnyConstructable>(
if (typeof dependenciesOrConstructor === 'function') {
// eslint-disable-next-line
constructor = dependenciesOrConstructor as T;
Service(optionsOrDependencies as ServiceOptions<T> & { dependencies: AnyInjectIdentifier[] })(constructor);
Service<T, TDependencies>(optionsOrDependencies as ServiceOptions<T> & { dependencies: AnyInjectIdentifier[] })(constructor);
} else if (maybeConstructor) {
constructor = maybeConstructor;
Service(optionsOrDependencies, dependenciesOrConstructor)(constructor);
Expand Down

0 comments on commit df3dfd3

Please sign in to comment.