From 16d378828b565096ab7e5188ba82cec8969a05fd Mon Sep 17 00:00:00 2001 From: Nicholas Cronquist Date: Sun, 24 May 2020 00:15:23 -0400 Subject: [PATCH] fix: Fix TokenResponse Type - The TokenResponse type was unioning to different types and so only the shared keys, oauth_callback_confirmed, were actually available as keys on that type - This change switches TokenResponse back to an interface and uses optional properties for keys that may not be present --- index.d.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/index.d.ts b/index.d.ts index 95d6d07..e4538cf 100644 --- a/index.d.ts +++ b/index.d.ts @@ -135,6 +135,7 @@ interface TwitterOptions { type OauthToken = string; type OauthTokenSecret = string; type AuthType = 'App' | 'User'; +type BoolStr = 'true' | 'false'; interface KeySecret { key: string; @@ -153,13 +154,11 @@ interface BearerResponse { access_token: string; } -type TokenResponse = - | { - oauth_token: OauthToken; - oauth_token_secret: OauthTokenSecret; - oauth_callback_confirmed: 'true'; - } - | { oauth_callback_confirmed: 'false' }; +interface TokenResponse { + oauth_token?: OauthToken; + oauth_token_secret?: OauthTokenSecret; + oauth_callback_confirmed: BoolStr; +} interface AccessTokenResponse { oauth_token: string;