Skip to content

Commit 800f041

Browse files
authored
Fix middleware interface (#422)
* chore: update ignored files * fix: update Middleware to include any service identifier * test: fix type error
1 parent b7ea184 commit 800f041

File tree

5 files changed

+10
-61
lines changed

5 files changed

+10
-61
lines changed

.gitignore

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,73 +3,25 @@ logs
33
*.log
44
npm-debug.log*
55

6-
# Runtime data
7-
pids
8-
*.pid
9-
*.seed
10-
11-
# Directory for instrumented libs generated by jscoverage/JSCover
12-
lib-cov
13-
146
# Coverage directory used by tools like istanbul
157
coverage
16-
.nyc_output
17-
18-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
19-
.grunt
20-
21-
# node-waf configuration
22-
.lock-wscript
23-
24-
# Compiled binary addons (http://nodejs.org/api/addons.html)
25-
build/Release
268

279
# Dependency directory
2810
node_modules
2911

3012
# Optional npm cache directory
3113
.npm
3214

33-
# Optional REPL history
34-
.node_repl_history
35-
36-
build
37-
bower_components
38-
docs
39-
bundled
40-
41-
typings
42-
.typingsrc
43-
dts
44-
dist
45-
lib
46-
es
47-
es6
48-
49-
type_definitions/inversify/*.js
50-
51-
#src/*.js
52-
src/**/*.js
53-
54-
#src/*.js.map
55-
src/**/*.js.map
56-
57-
src/*.d.ts
58-
src/decorator/*.d.ts
59-
src/factory/*.d.ts
60-
src/syntax/*.d.ts
61-
62-
#test/*.js
63-
test/**/*.js
64-
test/**/*.js.map
65-
66-
type_definitions/**/*.js
67-
type_definitions/*.js
68-
6915
# JetBrains IDE
7016
.idea
7117
.iml
7218
inversify-express-utils.iml
7319

7420
# OS folders
7521
.DS_Store
22+
23+
# Typescript build info
24+
tsconfig.cjs.tsbuildinfo
25+
26+
# Typescript compiled file
27+
lib

CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313
- Updated `BaseMiddleware.handler` to allow async handlers.
14+
- Updated `Middleware` to allow include any `ServiceIdentifier`.
1415

1516
### Fixed
1617

1718
## [6.4.10]
1819

19-
### Added
20-
21-
### Changed
22-
2320
### Fixed
2421
- Fixed `Controller` without wrong constraints (#417).
2522

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type DecoratorTarget<T = unknown> =
2525
| ConstructorFunction<T>
2626
| Prototype<T>;
2727

28-
export type Middleware = string | symbol | RequestHandler;
28+
export type Middleware = inversifyInterfaces.ServiceIdentifier | RequestHandler;
2929

3030
export interface MiddlewareMetaData {
3131
[identifier: string]: Middleware[];

src/test/framework.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import express, {
44
Application,
55
NextFunction,
66
Request,
7+
RequestHandler,
78
Response,
89
Router,
910
} from 'express';
@@ -31,7 +32,7 @@ describe('Unit Test: InversifyExpressServer', () => {
3132
});
3233

3334
it('should call the configFn before the errorConfigFn', () => {
34-
const middleware: Middleware = (
35+
const middleware: Middleware & RequestHandler = (
3536
_req: Request,
3637
_res: Response,
3738
_next: NextFunction,

tsconfig.cjs.tsbuildinfo

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)