question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

schema.ts Typescript compilation error - No overload matches this call

See original GitHub issue

Hi there, Just started getting Typescript build errors happening in the past few hours with 6.11.0, and also now with last 2 releases? I’ve been using 6.10.1 without issue since release. Tried downgrading to 6.10.1 and 6.10.0 and am still getting the same issue now? Did those versions get re-pushed, or is something else up?

I found the previously logged Typescript Issues with your npm 7 update, and already have my tsconfig file ignoring node_modules. It seems all the .ts source files are included in the release, whereas 6.9.2 changelog explicitly mentions that the .ts source files are removed?

Also did the obligatory node_modules delete and reinstall, same thing. Using npm 6.14.12 as I’ve found 7 to be a nightmare!

15 35.46 node_modules/express-validator/src/middlewares/schema.ts(72,15): error TS2769: No overload matches this call.
#15 35.46   Overload 1 of 2, '(predicate: (value: string, index: number, array: string[]) => value is keyof Validators<any> | keyof Sanitizers<any>, thisArg?: any): (keyof Validators<any> | keyof Sanitizers<...>)[]', gave the following error.
#15 35.46     Argument of type '(method: keyof ParamSchema) => method is keyof Validators<any> | keyof Sanitizers<any>' is not assignable to parameter of type '(value: string, index: number, array: string[]) => value is keyof Validators<any> | keyof Sanitizers<any>'.
#15 35.46       Types of parameters 'method' and 'value' are incompatible.
#15 35.46         Type 'string' is not assignable to type '"optional" | "in" | keyof Validators<any> | keyof Sanitizers<any> | "errorMessage"'.
#15 35.46   Overload 2 of 2, '(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]', gave the following error.
#15 35.46     Argument of type '(method: keyof ParamSchema) => method is keyof Validators<any> | keyof Sanitizers<any>' is not assignable to parameter of type '(value: string, index: number, array: string[]) => unknown'.
#15 35.46       Types of parameters 'method' and 'value' are incompatible.
#15 35.46         Type 'string' is not assignable to type '"optional" | "in" | keyof Validators<any> | keyof Sanitizers<any> | "errorMessage"'.
------

To Reproduce

Compile/build/load a project.

Express-validator Version: 6.11.0 Typescript v 4.2.4

Screen Shot 2021-05-07 at 10 48 08 PM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RinwaOwuogbacommented, Jan 30, 2022

In my case, the issue still persisted on the latest version of express-validator but I fixed it by updating my typescript version to a more recent one. 3.33.333 -> 4.2.3

My project uses TypeORM and running typeorm init seems to have installed a version of typescript that was causing these build issues with express-validator.

1reaction
gustavohenkecommented, May 8, 2021

Thanks all! Fix is in v6.11.1.

Read more comments on GitHub >

github_iconTop 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 >
TypeScript — Node.js - MongoDB
ts (19,59): error TS2769: No overload matches this call. The last overload gave the following error. Type 'string' is not assignable to type...
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 >
Types of relationships with Postgres & TypeORM. TypeScript ...
TSError: ⨯ Unable to compile TypeScript: src/post/post.controller.ts(32,21): error TS2769: No overload matches this call. Overload 1 of 3, ...
Read more >
property 'ref' does not exist on type 'intrinsicattributes - You.com
Generics error with forwardRef: Property 'ref' does not exist on type ... I am new to using Typescript with React. ... No overload...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found