chore(lint): enable unnecessary type parameter rule

This commit is contained in:
Peter Steinberger
2026-04-18 18:28:20 +01:00
parent 630f2bcabe
commit df525b90f2
94 changed files with 186 additions and 152 deletions

View File

@@ -32,11 +32,11 @@ type DeviceTokenResponse =
error_uri?: string;
};
function parseJsonResponse<T>(value: unknown): T {
function parseJsonResponse(value: unknown): Record<string, unknown> {
if (!value || typeof value !== "object") {
throw new Error("Unexpected response from GitHub");
}
return value as T;
return value as Record<string, unknown>;
}
async function requestDeviceCode(params: { scope: string }): Promise<DeviceCodeResponse> {
@@ -58,7 +58,7 @@ async function requestDeviceCode(params: { scope: string }): Promise<DeviceCodeR
throw new Error(`GitHub device code failed: HTTP ${res.status}`);
}
const json = parseJsonResponse<DeviceCodeResponse>(await res.json());
const json = parseJsonResponse(await res.json()) as DeviceCodeResponse;
if (!json.device_code || !json.user_code || !json.verification_uri) {
throw new Error("GitHub device code response missing fields");
}
@@ -90,7 +90,7 @@ async function pollForAccessToken(params: {
throw new Error(`GitHub device token failed: HTTP ${res.status}`);
}
const json = parseJsonResponse<DeviceTokenResponse>(await res.json());
const json = parseJsonResponse(await res.json()) as DeviceTokenResponse;
if ("access_token" in json && typeof json.access_token === "string") {
return json.access_token;
}