Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes.ts TSC Error expressAuthenticationRecasted #1624

Open
2 of 4 tasks
samuelexferri opened this issue May 7, 2024 · 0 comments
Open
2 of 4 tasks

Routes.ts TSC Error expressAuthenticationRecasted #1624

samuelexferri opened this issue May 7, 2024 · 0 comments

Comments

@samuelexferri
Copy link

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

TSC Ok

Current Behavior

I get this error:

src/routes/routes.ts:29:39 - error TS2352: Conversion of type '(expressRequest: Request, securityName: string, scopes: string[]) => Promise<void>' to type '(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, securityName: string, scopes?: string[] | undefined, res?: Response<...> | undefined) => Promise<...>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of parameters 'expressRequest' and 'req' are incompatible.
    Type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is missing the following properties from type 'Request': cache, credentials, destination, integrity, and 13 more.

29 const expressAuthenticationRecasted = expressAuthentication as (req: ExRequest, securityName: string, scopes?: string[], res?: ExResponse) => Promise<any>;

Found 1 error in src/routes/routes.ts:29

Possible Solution

Adding an unknown convertion probably fix:

const expressAuthenticationRecasted = expressAuthentication as (req: ExRequest, securityName: string, scopes?: string[], res?: ExResponse) => Promise<any>;
const expressAuthenticationRecasted = expressAuthentication as unknown as (req: ExRequest, securityName: string, scopes?: string[], res?: ExResponse) => Promise<any>;

Steps to Reproduce

Empty

Context (Environment)

Version of the library: v6.2.1
Version of NodeJS: 20

  • Confirm you were using yarn not npm: [X]

Detailed Description

Breaking change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant