From f50403f3815cb6cdec9bda0b08745920eee62dd6 Mon Sep 17 00:00:00 2001 From: sugoidogo Date: Sat, 1 Aug 2026 18:37:29 -0700 Subject: [PATCH] fix type errors --- static_src/TwitchAuth.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/static_src/TwitchAuth.ts b/static_src/TwitchAuth.ts index c82758b..1678a93 100644 --- a/static_src/TwitchAuth.ts +++ b/static_src/TwitchAuth.ts @@ -86,7 +86,7 @@ export function requestAccessToken(client_id: string, ...scopes: Array) * @param {Array|string} scopes * @returns {Promise} */ -export function requestAuthCode(client_id: string, ...scopes: Array): Promise { +export function requestAuthCode(client_id: string, ...scopes: Array): Promise { console.debug('requesting authorization code') const url = new URL('https://id.twitch.tv/oauth2/authorize') url.searchParams.append('response_type', 'code') @@ -178,7 +178,7 @@ export function refreshToken(client_id: string, refresh_token: string): Promise< * @param {string} client_id * @returns {TwitchToken} */ -export async function getUserToken(client_id: string, ...scopes): Promise { +export async function getUserToken(client_id: string, ...scopes:string[]): Promise { const token=await getUserTokenPassive(client_id, ...scopes) if(!token){ return requestAuthCode(client_id, ...scopes) @@ -193,19 +193,19 @@ export async function getUserToken(client_id: string, ...scopes): Promise{ +export async function getUserTokenPassive(client_id: string, ...scopes:string[]): Promise{ console.debug('scopes requested:',...scopes) const params = new URLSearchParams(location.search + '&' + location.hash.substring(1)) if (params.has('code')) { - const code = params.get('code') + const code = params.get('code')! history.replaceState(null, '', redirect_uri) return exchangeCode(client_id, code) } if (params.has('refresh_token')) { - return refreshToken(client_id, params.get('refresh_token')) + return refreshToken(client_id, params.get('refresh_token')!) } if (params.has('access_token')) { - return validateToken(params.get('access_token')) + return validateToken(params.get('access_token')!) } if (params.has('error')) { const error_message = params.get('error') + ': ' + params.get('error_description')