From 923c66df58ed430a02e2359dc2dd4d2d7476ecf6 Mon Sep 17 00:00:00 2001 From: Dan6erbond Date: Tue, 25 May 2021 14:32:06 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Update=20Facebook=20gen?= =?UTF-8?q?eric=20typing=20for=20custom=20profile=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/providers/facebook.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/providers/facebook.ts b/src/providers/facebook.ts index 09d97de..b77cf15 100644 --- a/src/providers/facebook.ts +++ b/src/providers/facebook.ts @@ -19,10 +19,10 @@ export interface FacebookTokens { interface FacebookOAuth2ProviderConfig extends OAuth2ProviderConfig { - userProfileFields?: string | (keyof FacebookProfile | string)[]; + userProfileFields?: string | (keyof ProfileType)[] | (string | number | symbol)[]; } -const defaultConfig: Partial = { +const defaultConfig: Partial> = { id: "facebook", scope: ["email", "public_profile", "user_link"], userProfileFields: [ @@ -41,12 +41,12 @@ const defaultConfig: Partial = { accessTokenUrl: "https://graph.facebook.com/v10.0/oauth/access_token", }; -export class FacebookOAuth2Provider extends OAuth2Provider< - FacebookProfile, +export class FacebookOAuth2Provider extends OAuth2Provider< + ProfileType, FacebookTokens, - FacebookOAuth2ProviderConfig + FacebookOAuth2ProviderConfig > { - constructor(config: FacebookOAuth2ProviderConfig) { + constructor(config: FacebookOAuth2ProviderConfig) { const userProfileFields = config.userProfileFields ?? defaultConfig.userProfileFields; const data = { fields: Array.isArray(userProfileFields) ? userProfileFields.join(",") : userProfileFields!,