Reputation: 5463
I'm trying to use the passport-local
package with TypeScript (2.0.0RC) but I'm getting a compiler error stating:
error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature
Screenshot of this in VS Code attached (the code under the tooltip is just passport.use(
).
I cannot for the life of me figure out how to give it the signature it wants.
I found a few issues on the topic, but anything I try just gives other compiler errors.
Does anyone have any suggestions how to make the compiler happy with this code?
Upvotes: 7
Views: 8373
Reputation: 1565
import * as PassportGoogle from "passport-google-oauth2";
passport.use(
new PassportGoogle.Strategy(
{
clientID: "",
clientSecret: "",
callbackURL: "http://localhost:3000/google/callback",
passReqToCallback: true,
},
function (request, accessToken, refreshToken, profile, done) {
}
)
);
Upvotes: 0
Reputation: 341
import { Strategy as LocalStrategy } from 'passport-local';
Upvotes: 34
Reputation: 353
Try this one:
import * as passportLocal from 'passport-local';
const LocalStrategy = passportLocal.Strategy;
Upvotes: 15