From d8b189e18a4cbf5a31cbdfb6de233963e94357fa Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Mon, 25 Mar 2024 10:04:10 +0900 Subject: [PATCH] chore: changed types to avoid casts everywhere --- src/parser/content-evaluator-module.ts | 3 +-- src/parser/user-extractor-module.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/parser/content-evaluator-module.ts b/src/parser/content-evaluator-module.ts index 4afa46d0..b050d7e3 100644 --- a/src/parser/content-evaluator-module.ts +++ b/src/parser/content-evaluator-module.ts @@ -4,7 +4,6 @@ import OpenAI from "openai"; import configuration from "../configuration/config-reader"; import { OPENAI_API_KEY } from "../configuration/constants"; import { IssueActivity } from "../issue-activity"; -import { GitHubIssue } from "../github-types"; import { GithubCommentScore, Module, Result } from "./processor"; /** @@ -24,7 +23,7 @@ export class ContentEvaluatorModule implements Module { for (const key of Object.keys(result)) { const currentElement = result[key]; const comments = currentElement.comments || []; - const specificationBody = (data.self as GitHubIssue)?.body; + const specificationBody = data.self?.body; if (specificationBody && comments.length) { promises.push(this._processComment(comments, specificationBody)); diff --git a/src/parser/user-extractor-module.ts b/src/parser/user-extractor-module.ts index bfa59b14..b0dc736a 100644 --- a/src/parser/user-extractor-module.ts +++ b/src/parser/user-extractor-module.ts @@ -50,9 +50,9 @@ export class UserExtractorModule implements Module { for (const comment of data.allComments) { if (comment.user && comment.body && this._checkEntryValidity(comment)) { const task = - (data.self as GitHubIssue)?.assignee?.id === comment.user.id + data.self?.assignee?.id === comment.user.id ? { - reward: this._extractTaskPrice(data.self as GitHubIssue), + reward: this._extractTaskPrice(data.self), } : undefined; result[comment.user.login] = {