Skip to content

Commit

Permalink
types: use overload to avoid ts-expect-error on generateServiceProvid…
Browse files Browse the repository at this point in the history
…erMetadata
  • Loading branch information
midgleyc committed Dec 7, 2020
1 parent 9c9c53d commit 6d0e220
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/passport-saml/multiSamlStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,24 @@ class MultiSamlStrategy extends SamlStrategy {
});
}

// @ts-expect-error typescript disallows changing method signature in a subclass
generateServiceProviderMetadata( decryptionCert: string | null, signingCert?: string | null ): never
generateServiceProviderMetadata(
req: Request,
decryptionCert: string | null,
signingCert: string | null,
callback: (err: Error | null, metadata?: string) => void
) {
): void
generateServiceProviderMetadata(
req: Request | string | null,
decryptionCert?: any,
signingCert?: any,
callback?: (err: Error | null, metadata?: string) => void
): void {
if (typeof callback !== 'function') {
throw new Error("Metadata can't be provided synchronously for MultiSamlStrategy.");
}

return this._options.getSamlOptions(req, (err, samlOptions) => {
return this._options.getSamlOptions(req as Request, (err, samlOptions) => {
if (err) {
return callback(err);
}
Expand Down

0 comments on commit 6d0e220

Please sign in to comment.