From 4a4dc24dd779ae3ef9c5c970783a84f0bb53ef36 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 31 Oct 2021 12:30:13 -0400 Subject: [PATCH] Names a `ViewsWithPullRequests` type --- src/views/nodes/pullRequestNode.ts | 13 +++---------- src/views/viewBase.ts | 7 +++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/views/nodes/pullRequestNode.ts b/src/views/nodes/pullRequestNode.ts index 79791a6..d67389b 100644 --- a/src/views/nodes/pullRequestNode.ts +++ b/src/views/nodes/pullRequestNode.ts @@ -3,25 +3,18 @@ import { ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscod import { Colors } from '../../constants'; import { GitBranch, GitCommit, PullRequest, PullRequestState } from '../../git/git'; import { GitUri } from '../../git/gitUri'; -import { BranchesView } from '../branchesView'; -import { CommitsView } from '../commitsView'; -import { ContributorsView } from '../contributorsView'; -import { RemotesView } from '../remotesView'; -import { RepositoriesView } from '../repositoriesView'; -import { SearchAndCompareView } from '../searchAndCompareView'; +import { ViewsWithPullRequests } from '../viewBase'; import { RepositoryNode } from './repositoryNode'; import { ContextValues, ViewNode } from './viewNode'; -export class PullRequestNode extends ViewNode< - BranchesView | CommitsView | ContributorsView | RemotesView | RepositoriesView | SearchAndCompareView -> { +export class PullRequestNode extends ViewNode { static key = ':pullrequest'; static getId(repoPath: string, id: string, ref: string): string { return `${RepositoryNode.getId(repoPath)}${this.key}(${id}):${ref}`; } constructor( - view: BranchesView | CommitsView | ContributorsView | RemotesView | RepositoriesView | SearchAndCompareView, + view: ViewsWithPullRequests, parent: ViewNode, public readonly pullRequest: PullRequest, public readonly branchOrCommit: GitBranch | GitCommit, diff --git a/src/views/viewBase.ts b/src/views/viewBase.ts index c436961..55f37da 100644 --- a/src/views/viewBase.ts +++ b/src/views/viewBase.ts @@ -66,6 +66,13 @@ export type ViewsWithCommits = | RepositoriesView | SearchAndCompareView | TagsView; +export type ViewsWithPullRequests = + | BranchesView + | CommitsView + | ContributorsView + | RemotesView + | RepositoriesView + | SearchAndCompareView; export interface TreeViewNodeCollapsibleStateChangeEvent extends TreeViewExpansionEvent { state: TreeItemCollapsibleState;