-
-
Notifications
You must be signed in to change notification settings - Fork 721
Closed
inversify/inversify-express-utils
#417Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
After updating inversify-express-utils from version 6.4.6 to 6.4.9, I encountered the following TypeScript error when using @controller and implementing interfaces.Controller:
error TS2420: Class 'HomeController' incorrectly implements interface 'Controller'.
Index signature for type 'string' is missing in type 'HomeController'.
The issue appears when using the HomeController class as follows:
@controller('/')
export default class HomeController implements interfaces.Controller {
private static readonly PRINT_VERSION = '4.6.2';
private logger: Logger = Logger.getInstance();
@httpGet('ping.html')
public async getPing(@request() req: Request, @response() res: Response): Promise<Response> {
this.logger.log(LogLevel.INFO, 'Ping-Seite aufgerufen.');
return res
.status(200)
.type('html')
.send(
`<html><head></head><body><div><ul><li><label id="appstatus">OK</label></li><li><label id="appversion">${
HomeController.PRINT_VERSION
}</label></li><li><label id="timestamp">${new Date().toLocaleString()}</label></li></ul></div></body></html>`
);
}
}Observations
- The issue was not present in version 6.4.6. The same code worked without any compilation errors.
- The documentation for inversify-express-utils (step 1) implies that implementing interfaces.Controller in this manner should still work.
- Upon reviewing the changes between versions, it seems that Controller in interfaces has undergone modifications since version 6.4.7.
Steps to reproduce
- Use the above HomeController class with inversify-express-utils 6.4.9
- Build the project
Expected behavior
The HomeController class should implement the interfaces.Controller interface without any TypeScript errors, as it did in version 6.4.6.
Possible solution
No response
Package version
6.1.6
Node.js version
20.15.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Stack trace
No response
Other
No response
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done