forked from mirrored/github-readme-stats
fix: resolve several vscode type errors inside fetchers code (#4579)
Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
co-authored by
Alexandr
parent
2df35521d7
commit
bf021b0670
@@ -12,17 +12,12 @@ import { logger, dateDiff } from "../../src/common/utils.js";
|
||||
|
||||
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple uptime check fetcher for the PATs.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} The response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
||||
*/
|
||||
const uptimeFetcher = (variables, token) => {
|
||||
return request(
|
||||
@@ -47,7 +42,7 @@ const getAllPATs = () => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {(variables: AxiosRequestHeaders, token: string) => Promise<AxiosResponse>} Fetcher The fetcher function.
|
||||
* @typedef {(variables: any, token: string) => Promise<import('axios').AxiosResponse>} Fetcher The fetcher function.
|
||||
* @typedef {{validPATs: string[], expiredPATs: string[], exhaustedPATs: string[], suspendedPATs: string[], errorPATs: string[], details: any}} PATInfo The PAT info.
|
||||
*/
|
||||
|
||||
@@ -55,10 +50,11 @@ const getAllPATs = () => {
|
||||
* Check whether any of the PATs is expired.
|
||||
*
|
||||
* @param {Fetcher} fetcher The fetcher function.
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @returns {Promise<PATInfo>} The response.
|
||||
*/
|
||||
const getPATInfo = async (fetcher, variables) => {
|
||||
/** @type {Record<string, any>} */
|
||||
const details = {};
|
||||
const PATs = getAllPATs();
|
||||
|
||||
|
||||
+2
-7
@@ -13,17 +13,12 @@ import { logger } from "../../src/common/utils.js";
|
||||
|
||||
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple uptime check fetcher for the PATs.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} The response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
||||
*/
|
||||
const uptimeFetcher = (variables, token) => {
|
||||
return request(
|
||||
|
||||
Reference in New Issue
Block a user