mxstbr / passport-magic-login

Passwordless authentication with magic links for Passport.js.
MIT License
668 stars 45 forks source link

export types #34

Open binaryartifex opened 1 year ago

binaryartifex commented 1 year ago

any chance of exporting the VerifyCallback and Options types? typescript isn't inferring the super class at all when used as part of a nestjs implementation...

import { Injectable } from "@nestjs/common";
import { PassportStrategy } from "@nestjs/passport";
import Strategy from "passport-magic-login";

@Injectable()
export class MagicLoginStrategy extends PassportStrategy(Strategy) {
  constructor() {
    super({...} as Options); // <-- would be nice to cast to the Option type here instead of digging through the type declarations
  }
}
adrianbienias commented 8 months ago

Workaround:

// ...
import Strategy from "passport-magic-login";
// ...
type Options = ConstructorParameters<typeof Strategy>[number];
// ...
    super({...} as Options);