Skip to content

Commit a8664d6

Browse files
authored
refactor: add user type (#1077)
1 parent d6af368 commit a8664d6

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/components/NotificationRow.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { shell } from 'electron';
88
import { mockAccounts, mockSettings } from '../__mocks__/mock-state';
99
import { mockedSingleNotification } from '../__mocks__/mockedData';
1010
import { AppContext } from '../context/App';
11+
import type { UserType } from '../typesGitHub';
1112
import { NotificationRow } from './NotificationRow';
1213

1314
describe('components/NotificationRow.tsx', () => {
@@ -179,7 +180,7 @@ describe('components/NotificationRow.tsx', () => {
179180
login: 'some-user',
180181
html_url: 'https://github.com/some-user',
181182
avatar_url: 'https://avatars.githubusercontent.com/u/123456789?v=4',
182-
type: 'User',
183+
type: 'User' as UserType,
183184
},
184185
},
185186
},

src/typesGitHub.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ export type IssueStateType = 'closed' | 'open';
3939

4040
export type IssueStateReasonType = 'completed' | 'not_planned' | 'reopened';
4141

42+
export type UserType =
43+
| 'Bot'
44+
| 'EnterpriseUserAccount'
45+
| 'Mannequin'
46+
| 'Organization'
47+
| 'User';
48+
4249
/**
4350
* Note: draft and merged are not official states in the GitHub API.
4451
* These are derived from the pull request's `merged` and `draft` properties.
@@ -133,22 +140,22 @@ export interface User {
133140
repos_url: string;
134141
events_url: string;
135142
received_events_url: string;
136-
type: string;
143+
type: UserType;
137144
site_admin: boolean;
138145
}
139146

140147
export interface SubjectUser {
141148
login: string;
142149
html_url: string;
143150
avatar_url: string;
144-
type: string;
151+
type: UserType;
145152
}
146153

147154
export interface DiscussionAuthor {
148155
login: string;
149156
url: string;
150157
avatar_url: string;
151-
type: string;
158+
type: UserType;
152159
}
153160

154161
export interface Repository {

0 commit comments

Comments
 (0)