Bug: [TS] No overload matches this call.
See original GitHub issueDescribe the bug
When using as middleware typescript complains about the ValidationChain
not being assignable to a RequestHandler
const getCertificateValidation = [
query('data')
.not()
.isEmpty()
.trim()
.isBase64()
.customSanitizer((value) => JSON.parse(Buffer.from(value, 'base64').toString()))
.isJSON(),
];
routes.get('/investors/certificate', getCertificateValidation, getCertificate);
Error in full:
No overload matches this call.
Overload 1 of 3, '(path: PathParams, ...handlers: RequestHandler<null, any, null, SanitisedQueryData>[]): Router', gave the following error.
Argument of type 'ValidationChain[]' is not assignable to parameter of type 'RequestHandler<null, any, null, SanitisedQueryData>'.
Type 'ValidationChain[]' provides no match for the signature '(req: Request<null, any, null, SanitisedQueryData>, res: Response<any, number>, next: NextFunction): any'.
Overload 2 of 3, '(path: PathParams, ...handlers: RequestHandlerParams<Record<string, any> | undefined, any, null, SanitisedQueryData>[]): Router', gave the following error.
Argument of type '(req: Request<null, null, null, SanitisedQueryData>, res: Response) => Promise<void>' is not assignable to parameter of type 'RequestHandlerParams<Record<string, any> | undefined, any, null, SanitisedQueryData>'.
Type '(req: Request<null, null, null, SanitisedQueryData>, res: Response) => Promise<void>' is not assignable to type 'RequestHandler<Record<string, any> | undefined, any, null, SanitisedQueryData>'.
Types of parameters 'req' and 'req' are incompatible.
Type 'Request<Record<string, any> | undefined, any, null, SanitisedQueryData>' is not assignable to type 'Request<null, null, null, SanitisedQueryData>'.
Types of property 'params' are incompatible.
Type 'Record<string, any> | undefined' is not assignable to type 'null'.
Type 'undefined' is not assignable to type 'null'.
Express-validator version:
- Version: 6.8.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
No overload matches this call. Type 'string' is not assignable to ...
This happens when you do not assign your types properly. Your variable data Type MUST match the passing data type ...
Read more >No overload matches this call with styled components ...
No overload matches this call in TypeScript is really annoying and there aren't too many solutions around there, though we have a solution!...
Read more >"No overload matches this call" typescript error when passing ...
The problem is that Stores is typed as "array needs to contain at least one entry", while stores is typed as "array with...
Read more >No overload matches this call when trying to use array.reduce
I get the output I'm looking for, but typescript is yelling at me with this 700 line error message: No overload matches this...
Read more >TS2769: No overload matches this call error when building ...
[tsl] ERROR in /home/node/app/resources/js/educational/components/ActionForm.vue.ts(4,3) TS2769: No overload matches this call. Overload 1 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will do can’t say I’ll get to it today but sometime this week.
Thanks!