Skip to content

Commit 3cf9290

Browse files
committed
mr: add type for BranchIdentity
#170
1 parent 8feaa9c commit 3cf9290

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/features/repo-explorer/components/branches-menu/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from "react";
22
import { Menu } from "antd";
33
import { Link } from "react-router-dom";
4-
import { RepoIdentity } from "models";
4+
import { RepoIdentity, BranchIdentity } from "models";
55
import "./index.scss";
66

77
type Props = {
88
repo: RepoIdentity;
9-
branches?: Array<{ name: string; prefix: string }>;
9+
branches?: Array<BranchIdentity>;
1010
};
1111

1212
const BranchesMenu = ({ repo, branches }: Props) => {

src/features/repo-explorer/components/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { RepoIdentity } from "models";
2+
import { RepoIdentity, BranchIdentity } from "models";
33
import {
44
useRepoBranchInfoQuery,
55
useRepoDefaultBranchQuery,
@@ -33,7 +33,7 @@ const useBranch = (repo: Props["repo"]) => {
3333
const useRepoDetails = (repoInfo: RepoBranchInfoQuery | undefined) => {
3434
const { repository } = repoInfo || {};
3535
const branches = (repository?.refs?.nodes || []).filter(
36-
(branch): branch is { name: string; prefix: string } => !!branch,
36+
(branch): branch is BranchIdentity => !!branch,
3737
);
3838
const files = Array.from(repository?.object?.entries ?? []).sort((a, b) =>
3939
b.type.localeCompare(a.type),

src/features/repo-explorer/components/toolbar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Button, Dropdown, Popover } from "antd";
22
import React from "react";
3-
import { RepoIdentity } from "models";
3+
import { RepoIdentity, BranchIdentity } from "models";
44
import BranchesMenu from "../branches-menu";
55
import CloneMenu from "./clone-menu";
66
import "./index.scss";
77

88
type Props = {
99
repo: RepoIdentity;
10-
branches: Array<{ name: string; prefix: string }>;
10+
branches: Array<BranchIdentity>;
1111
activeBranch: string;
1212
};
1313

src/models.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,13 @@ export type AppError = {
2424
/** Описание */
2525
description: string;
2626
};
27+
28+
/**
29+
* Идентификационные данные ветки
30+
*/
31+
export type BranchIdentity = {
32+
/** Имя */
33+
name: string;
34+
/** Префикс ветки */
35+
prefix: string;
36+
};

0 commit comments

Comments
 (0)