File tree Expand file tree Collapse file tree 5 files changed +27
-15
lines changed
tests/fixtures/inversify-async Expand file tree Collapse file tree 5 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 33
33
"@tsoa/runtime" : " ^6.5.1" ,
34
34
"@types/multer" : " ^1.4.12" ,
35
35
"fs-extra" : " ^11.2.0" ,
36
- "glob" : " ^10.3.10 " ,
36
+ "glob" : " ^11.0.0 " ,
37
37
"handlebars" : " ^4.7.8" ,
38
- "merge-anything" : " ^5.1.4 " ,
39
- "minimatch" : " ^9 .0.1" ,
40
- "ts-deepmerge" : " ^7.0.1 " ,
41
- "typescript" : " ^5.6 .2" ,
38
+ "merge-anything" : " ^5.1.7 " ,
39
+ "minimatch" : " ^10 .0.1" ,
40
+ "ts-deepmerge" : " ^7.0.2 " ,
41
+ "typescript" : " ^5.7 .2" ,
42
42
"validator" : " ^13.12.0" ,
43
- "yaml" : " ^2.5 .1" ,
43
+ "yaml" : " ^2.6 .1" ,
44
44
"yargs" : " ^17.7.1"
45
45
},
46
46
"devDependencies" : {
Original file line number Diff line number Diff line change 29
29
"license" : " MIT" ,
30
30
"dependencies" : {
31
31
"@hapi/boom" : " ^10.0.1" ,
32
- "@hapi/hapi" : " ^21.3.10 " ,
32
+ "@hapi/hapi" : " ^21.3.12 " ,
33
33
"@types/koa" : " ^2.15.0" ,
34
34
"@types/multer" : " ^1.4.12" ,
35
- "express" : " ^4.21.0 " ,
35
+ "express" : " ^4.21.2 " ,
36
36
"reflect-metadata" : " ^0.2.2" ,
37
37
"validator" : " ^13.12.0"
38
38
},
39
39
"devDependencies" : {
40
40
"@types/node" : " ^18.0.0" ,
41
41
"@types/validator" : " ^13.12.2" ,
42
- "typescript" : " ^5.6 .2"
42
+ "typescript" : " ^5.7 .2"
43
43
},
44
44
"repository" : {
45
45
"type" : " git" ,
Original file line number Diff line number Diff line change 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 ;
3
13
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 > ;
5
17
}
6
18
7
19
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Original file line number Diff line number Diff line change 33
33
},
34
34
"devDependencies" : {
35
35
"@types/node" : " ^18.0.0" ,
36
- "typescript" : " ^5.6 .2"
36
+ "typescript" : " ^5.7 .2"
37
37
},
38
38
"repository" : {
39
39
"type" : " git" ,
Original file line number Diff line number Diff line change 1
- import { Container } from 'inversify' ;
1
+ import { Container , interfaces } from 'inversify' ;
2
2
import { AsyncController } from './asyncController' ;
3
3
import { AsyncService } from './asyncService' ;
4
4
import { AsyncErrorController } from './asyncErrorController' ;
@@ -15,7 +15,7 @@ container.bind('error').toFactory(() => {
15
15
container . bind < AsyncErrorController > ( AsyncErrorController ) . to ( AsyncErrorController ) . inSingletonScope ( ) ;
16
16
17
17
const iocContainer = {
18
- async get < T > ( controller : { prototype : T } ) : Promise < T > {
18
+ async get < T > ( controller : interfaces . ServiceIdentifier < T > ) : Promise < T > {
19
19
return container . get ( controller ) ;
20
20
} ,
21
21
} ;
You can’t perform that action at this time.
0 commit comments