Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Commit 3739ef9

Browse files
Merge pull request #117 from PierreDemailly/add-IssuesByRepoName-type
add IssuesByRepoName type
2 parents ce6c4f3 + 38b394f commit 3739ef9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/issueFinder.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export interface Issue {
1010
labels: string[];
1111
}
1212

13+
export type RepoName = string;
14+
15+
export type IssuesByRepoName = Map<RepoName, Issue[]>;
16+
1317
export class IssueFinder {
1418
private readonly config: Config;
1519
private readonly fetcher: GitHubIssueFetcher;
@@ -22,7 +26,7 @@ export class IssueFinder {
2226
public async findIssues(
2327
token: string,
2428
repositoryIdentifiers: string[]
25-
): Promise<Map<string, Issue[]>> {
29+
): Promise<IssuesByRepoName> {
2630
const gitHubIssues: GitHubIssue[] = [];
2731
for (const label of this.config.labelsToSearch) {
2832
const result = await this.fetcher.fetchMatchingIssues(
@@ -41,7 +45,7 @@ export class IssueFinder {
4145

4246
const uniqueIssues = this.omitDuplicates(arrayOfIssues);
4347

44-
const issuesByRepo = new Map<string, Issue[]>();
48+
const issuesByRepo = new Map<RepoName, Issue[]>();
4549
uniqueIssues.forEach((issue) => {
4650
const repo = issue.repositoryNameWithOwner;
4751
const existing = issuesByRepo.get(repo) || [];
@@ -74,7 +78,7 @@ export class IssueFinder {
7478
}
7579

7680
private omitDuplicates(issues: Issue[]): Issue[] {
77-
const map = new Map<string, Issue>();
81+
const map = new Map<RepoName, Issue>();
7882
issues.forEach((issue) => {
7983
map.set(issue.url, issue);
8084
});

0 commit comments

Comments
 (0)