You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/test.ts:6:3 - error TS2322: Type 'SecretCallback' is not assignable to type 'SecretOrKeyProvider'.
Types of parameters 'req' and 'request' are incompatible.
Type 'Request' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': get, header, accepts, acceptsCharsets, and 100 more.
6 secretOrKeyProvider: passportJwtSecret({
~~~~~~~~~~~~~~~~~~~
../../node_modules/@types/passport-jwt/index.d.ts:12:5
12 secretOrKeyProvider?: SecretOrKeyProvider | undefined;
~~~~~~~~~~~~~~~~~~~
The expected type comes from property 'secretOrKeyProvider' which is declared here on type 'StrategyOptions'
Looking at the source code for the passport integration, it appears that the req parameter isn't even used. I think that means that it would be safe to type this as unknown in the type definitions and avoid this issue happening again if Passport integrates the proposed PR to change this type again from Request to IncomingMessage.
Edit: see below. I have opened a PR that changes this parameter to unknown typing to remove the mismatch error for users on both the v3 and v4 typedefs for passport.
Checklist
Description
It works on
@types/passport-jwt@3.0.13
, but the build fails on@types/passport-jwt@4.0.0
due to type changes.This is caused by changes in the following parts.
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67897/files#diff-b71c8d6ec401ffed807cc36d147e6eda88a0a5eb1a17175172ce9004026d8b79R38-L41
The following patch can be used as a simple change.
https://github.com/auth0/node-jwks-rsa/blob/master/index.d.ts#L68-L74
Reproduction
Additional context
DefinitelyTyped/DefinitelyTyped#67897
jwks-rsa version
v3.1.0
Node.js version
v20.10.0
The text was updated successfully, but these errors were encountered: