In the example the following piece of code is used:
import { BearerStrategy } from 'passport-azure-ad'
const bearerStrategy = new BearerStrategy(config, (token, done) => {
// Send user info using the second argument
done(null, {}, token);
}
);
This throws the following TS error:
src/index.ts:26:12 - error TS2349: This expression is not callable.
Type 'ITokenPayload' has no call signatures.
26 return done(null, {}, token)
Although the code works I was wondering how to avoid this error.
You can add types to each of the parameters.
new BearerStrategy(config, (token: ITokenPayload, done: CallableFunction) => ...