Skip to content

Commit

Permalink
Fix middleware interface (#422)
Browse files Browse the repository at this point in the history
* chore: update ignored files

* fix: update Middleware to include any service identifier

* test: fix type error
  • Loading branch information
notaphplover authored Jan 30, 2025
1 parent b7ea184 commit 800f041
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 61 deletions.
60 changes: 6 additions & 54 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,25 @@ logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

build
bower_components
docs
bundled

typings
.typingsrc
dts
dist
lib
es
es6

type_definitions/inversify/*.js

#src/*.js
src/**/*.js

#src/*.js.map
src/**/*.js.map

src/*.d.ts
src/decorator/*.d.ts
src/factory/*.d.ts
src/syntax/*.d.ts

#test/*.js
test/**/*.js
test/**/*.js.map

type_definitions/**/*.js
type_definitions/*.js

# JetBrains IDE
.idea
.iml
inversify-express-utils.iml

# OS folders
.DS_Store

# Typescript build info
tsconfig.cjs.tsbuildinfo

# Typescript compiled file
lib
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Updated `BaseMiddleware.handler` to allow async handlers.
- Updated `Middleware` to allow include any `ServiceIdentifier`.

### Fixed

## [6.4.10]

### Added

### Changed

### Fixed
- Fixed `Controller` without wrong constraints (#417).

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type DecoratorTarget<T = unknown> =
| ConstructorFunction<T>
| Prototype<T>;

export type Middleware = string | symbol | RequestHandler;
export type Middleware = inversifyInterfaces.ServiceIdentifier | RequestHandler;

export interface MiddlewareMetaData {
[identifier: string]: Middleware[];
Expand Down
3 changes: 2 additions & 1 deletion src/test/framework.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import express, {
Application,
NextFunction,
Request,
RequestHandler,
Response,
Router,
} from 'express';
Expand Down Expand Up @@ -31,7 +32,7 @@ describe('Unit Test: InversifyExpressServer', () => {
});

it('should call the configFn before the errorConfigFn', () => {
const middleware: Middleware = (
const middleware: Middleware & RequestHandler = (
_req: Request,
_res: Response,
_next: NextFunction,
Expand Down
1 change: 0 additions & 1 deletion tsconfig.cjs.tsbuildinfo

This file was deleted.

0 comments on commit 800f041

Please sign in to comment.