Skip to content

Commit f2f666e

Browse files
authored
Merge pull request #1718 from helios-ag/dev
Fix incompatibility with latest InversifyJS
2 parents 29d678d + 005f125 commit f2f666e

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

packages/runtime/src/interfaces/iocModule.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
export interface IocContainer {
2-
get<T>(controller: { prototype: T }): T;
1+
export type Newable<
2+
T = unknown,
3+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4+
TArgs extends unknown[] = any[],
5+
> = new (...args: TArgs) => T;
6+
7+
export type ServiceIdentifier<T = unknown> =
8+
| string
9+
| symbol
10+
| Newable<T>
11+
// eslint-disable-next-line @typescript-eslint/ban-types
12+
| Function;
313

4-
get<T>(controller: { prototype: T }): Promise<T>;
14+
export interface IocContainer {
15+
get<T>(controller: ServiceIdentifier<T>): T;
16+
get<T>(controller: ServiceIdentifier<T>): Promise<T>;
517
}
618

719
// eslint-disable-next-line @typescript-eslint/no-explicit-any

tests/fixtures/inversify-async/ioc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Container } from 'inversify';
1+
import { Container, interfaces } from 'inversify';
22
import { AsyncController } from './asyncController';
33
import { AsyncService } from './asyncService';
44
import { AsyncErrorController } from './asyncErrorController';
@@ -15,7 +15,7 @@ container.bind('error').toFactory(() => {
1515
container.bind<AsyncErrorController>(AsyncErrorController).to(AsyncErrorController).inSingletonScope();
1616

1717
const iocContainer = {
18-
async get<T>(controller: { prototype: T }): Promise<T> {
18+
async get<T>(controller: interfaces.ServiceIdentifier<T>): Promise<T> {
1919
return container.get(controller);
2020
},
2121
};

0 commit comments

Comments
 (0)