From 8480879762c7e78a2e4a193cdc69921f0e17b9f5 Mon Sep 17 00:00:00 2001 From: Marc Knaup Date: Thu, 10 Jan 2019 21:34:13 +0100 Subject: [PATCH] Updated types of facebook-js-sdk to version 3.2 & works around bogus documentation --- types/facebook-js-sdk/facebook-js-sdk-tests.ts | 8 ++++++++ types/facebook-js-sdk/index.d.ts | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/types/facebook-js-sdk/facebook-js-sdk-tests.ts b/types/facebook-js-sdk/facebook-js-sdk-tests.ts index 46b9f331f5..db8b13686e 100644 --- a/types/facebook-js-sdk/facebook-js-sdk-tests.ts +++ b/types/facebook-js-sdk/facebook-js-sdk-tests.ts @@ -22,6 +22,14 @@ FB.getLoginStatus(function(response: fb.StatusResponse) { const authResponse: fb.AuthResponse = FB.getAuthResponse(); console.log(authResponse.accessToken); +FB.login(); + +FB.login(function(response: fb.StatusResponse) { + console.log(response); + console.log(response.status); + console.log(response.authResponse.accessToken); +}); + FB.login(function(response: fb.StatusResponse) { console.log(response); console.log(response.status); diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index 86ca521c88..c4f3b78c31 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for the Facebook Javascript SDK 3.1 +// Type definitions for the Facebook Javascript SDK 3.2 // Project: https://developers.facebook.com/docs/javascript // Definitions by: Amrit Kahlon // Mahmoud Zohdi @@ -50,7 +50,7 @@ declare namespace facebook { * @param callback function to handle the response. * @param options optional ILoginOption to add params such as scope. */ - login(callback: (response: StatusResponse) => void, options: LoginOptions): void; + login(callback: (response: StatusResponse) => void, options?: LoginOptions): void; /** * Use this function to log the user in @@ -61,12 +61,12 @@ declare namespace facebook { * * @param options optional ILoginOption to add params such as scope. */ - login(options: LoginOptions): void; + login(options?: LoginOptions): void; /** * The method FB.logout() logs the user out of your site and, in some cases, Facebook. * - * @param callback function to handle the response + * @param callback optional function to handle the response */ logout(callback?: (response: StatusResponse) => void): void;