icebear0828 Claude Opus 4.6 commited on
Commit
8fc11c2
·
1 Parent(s): d0eb8b9

fix: remove all `any` types from source code

Browse files

Replace `catch (err: any)` with `unknown` + type-safe access,
and `(err as any).code` with intersection type cast.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. src/auth/oauth-pkce.ts +1 -1
  2. src/routes/auth.ts +2 -2
src/auth/oauth-pkce.ts CHANGED
@@ -377,7 +377,7 @@ export async function pollDeviceToken(deviceCode: string): Promise<TokenResponse
377
  if (!resp.ok) {
378
  const data = JSON.parse(resp.body) as { error?: string; error_description?: string };
379
  const err = new Error(data.error_description || data.error || `Poll failed (${resp.status})`);
380
- (err as any).code = data.error;
381
  throw err;
382
  }
383
 
 
377
  if (!resp.ok) {
378
  const data = JSON.parse(resp.body) as { error?: string; error_description?: string };
379
  const err = new Error(data.error_description || data.error || `Poll failed (${resp.status})`);
380
+ (err as Error & { code?: string }).code = data.error;
381
  throw err;
382
  }
383
 
src/routes/auth.ts CHANGED
@@ -186,8 +186,8 @@ export function createAuthRoutes(
186
 
187
  console.log(`[Auth] Device code flow completed — account ${entryId} added`);
188
  return c.json({ success: true });
189
- } catch (err: any) {
190
- const code = err.code || "unknown";
191
  if (code === "authorization_pending" || code === "slow_down") {
192
  return c.json({ pending: true, code });
193
  }
 
186
 
187
  console.log(`[Auth] Device code flow completed — account ${entryId} added`);
188
  return c.json({ success: true });
189
+ } catch (err: unknown) {
190
+ const code = (err as { code?: string }).code || "unknown";
191
  if (code === "authorization_pending" || code === "slow_down") {
192
  return c.json({ pending: true, code });
193
  }