在示例中使用了以下代码:
import { BearerStrategy } from 'passport-azure-ad'
const bearerStrategy = new BearerStrategy(config, (token, done) => {
// Send user info using the second argument
done(null, {}, token);
}
);这会引发以下TS错误:

src/index.ts:26:12 - error TS2349: This expression is not callable.
Type 'ITokenPayload' has no call signatures.
26 return done(null, {}, token)虽然代码可以工作,但我想知道如何避免这个错误。
发布于 2020-07-27 10:04:23
可以将类型添加到每个参数中。
new BearerStrategy(config, (token: ITokenPayload, done: CallableFunction) => ...
https://stackoverflow.com/questions/63111105
复制相似问题