From 4826e4424bda595272ffce647aa66b4f1520811c Mon Sep 17 00:00:00 2001 From: Fernand Date: Thu, 21 Mar 2024 15:50:13 +0900 Subject: [PATCH] chore: fixed TypeScript compile errors --- jest.config.ts | 10 +++++----- src/parser/data-purge-module.ts | 1 - src/parser/processor.ts | 5 ++--- src/parser/user-extractor-module.ts | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/jest.config.ts b/jest.config.ts index f105bda4..86710cfc 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -1,10 +1,10 @@ -import { config } from "dotenv"; +// import { config } from "dotenv"; import type { Config } from "jest"; -config(); -const GITHUB_TOKEN = process.env.GITHUB_TOKEN; -const OPENAI_API_KEY = process.env.OPENAI_API_KEY; -process.argv = ["path/to/node", "path/to/script", `--auth`, `${GITHUB_TOKEN}`, "--open-ai", `${OPENAI_API_KEY}`]; +// config(); +// const GITHUB_TOKEN = process.env.GITHUB_TOKEN; +// const OPENAI_API_KEY = process.env.OPENAI_API_KEY; +// process.argv = ["path/to/node", "path/to/script", `--auth`, `${GITHUB_TOKEN}`, "--open-ai", `${OPENAI_API_KEY}`]; const cfg: Config = { transform: { diff --git a/src/parser/data-purge-module.ts b/src/parser/data-purge-module.ts index 71f54743..d49e0e92 100644 --- a/src/parser/data-purge-module.ts +++ b/src/parser/data-purge-module.ts @@ -27,7 +27,6 @@ export class DataPurgeModule implements Module { { content: newContent, url: value.html_url, - contentHtml: value.body_html, type: value.type, }, ]; diff --git a/src/parser/processor.ts b/src/parser/processor.ts index 59c3cac7..6b776b8b 100644 --- a/src/parser/processor.ts +++ b/src/parser/processor.ts @@ -1,6 +1,6 @@ import * as fs from "fs"; import configuration from "../configuration/config-reader"; -import { GetActivity } from "../get-activity"; +import { CommentType, GetActivity } from "../get-activity"; import program from "./command-line"; import { ContentEvaluatorModule } from "./content-evaluator-module"; import { DataPurgeModule } from "./data-purge-module"; @@ -85,9 +85,8 @@ export interface Result { export interface GithubComment { content: string; - contentHtml?: string; url: string; - type: string; + type: CommentType; score?: { formatting?: { content: Record; diff --git a/src/parser/user-extractor-module.ts b/src/parser/user-extractor-module.ts index 21ff72e9..02bd1e8c 100644 --- a/src/parser/user-extractor-module.ts +++ b/src/parser/user-extractor-module.ts @@ -1,6 +1,6 @@ import configuration from "../configuration/config-reader"; import { GetActivity } from "../get-activity"; -import { GitHubIssue, GitHubIssueComment, GitHubPullRequestReviewComment } from "../github-types"; +import { GitHubIssue } from "../github-types"; import { Module, Result } from "./processor"; /** @@ -16,7 +16,7 @@ export class UserExtractorModule implements Module { /** * Checks if the comment is made by a human user, and not empty. */ - _checkEntryValidity(comment: GitHubIssueComment | GitHubPullRequestReviewComment) { + _checkEntryValidity(comment: (typeof GetActivity.prototype.allComments)[0]) { return comment.body && comment.user?.type === "User"; }