File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed
browser-extension/src/datamodel/handlers Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change 11import { OverType } from '../../overtype/mock-overtype'
22import type { CommentEnhancer , CommentSpot } from '../enhancer'
33
4- export type GitHubCommentType =
5- | 'GH_ISSUE_NEW'
6- | 'GH_PR_NEW'
7- | 'GH_ISSUE_ADD_COMMENT'
8- | 'GH_ISSUE_EDIT_COMMENT'
9- | 'GH_PR_ADD_COMMENT'
10- | 'GH_PR_EDIT_COMMENT'
11- | 'GH_PR_CODE_COMMENT'
4+ const GITHUB_COMMENT_TYPES = [
5+ 'GH_ISSUE_NEW' ,
6+ 'GH_PR_NEW' ,
7+ 'GH_ISSUE_ADD_COMMENT' ,
8+ 'GH_ISSUE_EDIT_COMMENT' ,
9+ 'GH_PR_ADD_COMMENT' ,
10+ 'GH_PR_EDIT_COMMENT' ,
11+ 'GH_PR_CODE_COMMENT' ,
12+ ] as const
13+
14+ export type GitHubCommentType = ( typeof GITHUB_COMMENT_TYPES ) [ number ]
1215
1316export interface GitHubContext extends CommentSpot {
1417 type : GitHubCommentType // Override to narrow from string to specific union
@@ -20,15 +23,7 @@ export interface GitHubContext extends CommentSpot {
2023
2124export class GitHubHandler implements CommentEnhancer < GitHubContext > {
2225 forCommentTypes ( ) : string [ ] {
23- return [
24- 'GH_ISSUE_NEW' ,
25- 'GH_PR_NEW' ,
26- 'GH_ISSUE_ADD_COMMENT' ,
27- 'GH_ISSUE_EDIT_COMMENT' ,
28- 'GH_PR_ADD_COMMENT' ,
29- 'GH_PR_EDIT_COMMENT' ,
30- 'GH_PR_CODE_COMMENT' ,
31- ]
26+ return [ ...GITHUB_COMMENT_TYPES ]
3227 }
3328
3429 tryToEnhance ( textarea : HTMLTextAreaElement ) : [ OverType , GitHubContext ] | null {
You can’t perform that action at this time.
0 commit comments