mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-19 17:16:48 +00:00
Made some type annotations narrower.
This commit is contained in:
parent
d8d4c48779
commit
75f6a9a343
1 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ const argv = yargs(hideBin(process.argv))
|
||||||
alias: "t",
|
alias: "t",
|
||||||
type: "string",
|
type: "string",
|
||||||
description: "GitHub personal access token",
|
description: "GitHub personal access token",
|
||||||
demandOption: true,
|
demandOption: false,
|
||||||
default: process.env.GITHUB_TOKEN,
|
default: process.env.GITHUB_TOKEN,
|
||||||
})
|
})
|
||||||
.option("owner", {
|
.option("owner", {
|
||||||
|
@ -79,7 +79,7 @@ const csvWriter = createObjectCsvWriter({
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const reactionToCategory: { [key: string]: string } = {
|
const reactionToCategory: Record<string, string> = {
|
||||||
"+1": "Useful",
|
"+1": "Useful",
|
||||||
eyes: "Noisy",
|
eyes: "Noisy",
|
||||||
confused: "Hallucination",
|
confused: "Hallucination",
|
||||||
|
@ -87,7 +87,7 @@ const reactionToCategory: { [key: string]: string } = {
|
||||||
"-1": "Incorrect",
|
"-1": "Incorrect",
|
||||||
};
|
};
|
||||||
|
|
||||||
function extractCategories(reactions: any): string[] {
|
function extractCategories(reactions: Record<string, any>): string[] {
|
||||||
return Object.keys(reactions)
|
return Object.keys(reactions)
|
||||||
.filter(
|
.filter(
|
||||||
(reaction) => reactionToCategory[reaction] && reactions[reaction] > 0
|
(reaction) => reactionToCategory[reaction] && reactions[reaction] > 0
|
||||||
|
@ -122,7 +122,7 @@ async function fetchCommentsForPR(prNumber: number): Promise<Comment[]> {
|
||||||
);
|
);
|
||||||
|
|
||||||
let comments: Comment[] = await Promise.all(
|
let comments: Comment[] = await Promise.all(
|
||||||
response.data.map(async (comment: any) => {
|
response.data.map(async (comment: Record<string, any>) => {
|
||||||
const categories = extractCategories(comment.reactions);
|
const categories = extractCategories(comment.reactions);
|
||||||
return {
|
return {
|
||||||
author: comment.user.login,
|
author: comment.user.login,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue