Encountering issues when attempting to utilize constructor spreads with decorators in TypeScript, here is the code snippet:
export function httpGet(path?: string, ...middlewares : Function[]) { };
Usage example:
class Controller {
@httpGet('/:id')
async get(ctx: Context) { .... }
}
Resulting in the following error:
Cannot invoke an expression whose type lacks a call signature.
30 @httpGet('/:id')
~~~~~~~~~~~~~~~~
src/api/Controller.ts(30,3): error TS1241: Unable to resolve signature
of method decorator when called as an expression.