(data: unknown)
| 209 | } |
| 210 | |
| 211 | function parseGithubAccessTokenResponse(data: unknown): GithubAccessTokenResponse { |
| 212 | if (!data || typeof data !== "object") { |
| 213 | return {}; |
| 214 | } |
| 215 | |
| 216 | const record = data as Record<string, unknown>; |
| 217 | |
| 218 | const intervalValue = record.interval; |
| 219 | const interval = |
| 220 | typeof intervalValue === "number" && Number.isFinite(intervalValue) && intervalValue > 0 |
| 221 | ? intervalValue |
| 222 | : undefined; |
| 223 | |
| 224 | return { |
| 225 | access_token: normalizeOptionalString(record.access_token), |
| 226 | error: normalizeOptionalString(record.error), |
| 227 | error_description: normalizeOptionalString(record.error_description), |
| 228 | interval, |
| 229 | }; |
| 230 | } |
| 231 | |
| 232 | function parseGithubUserResponse(data: unknown): GithubUserResponse { |
| 233 | if (!data || typeof data !== "object") { |
no test coverage detected