@@ -124,7 +124,7 @@ export function initRepoIssueFilterItemLabel() {
124
124
125
125
export function initRepoIssueCommentDelete ( ) {
126
126
// Delete comment
127
- document . addEventListener ( 'click' , async ( e ) => {
127
+ document . addEventListener ( 'click' , async ( e : MouseEvent & { target : HTMLElement } ) => {
128
128
if ( ! e . target . matches ( '.delete-comment' ) ) return ;
129
129
e . preventDefault ( ) ;
130
130
@@ -143,7 +143,7 @@ export function initRepoIssueCommentDelete() {
143
143
const counter = document . querySelector ( '#review-box .review-comments-counter' ) ;
144
144
let num = parseInt ( counter ?. getAttribute ( 'data-pending-comment-number' ) ) - 1 || 0 ;
145
145
num = Math . max ( num , 0 ) ;
146
- counter . setAttribute ( 'data-pending-comment-number' , num ) ;
146
+ counter . setAttribute ( 'data-pending-comment-number' , String ( num ) ) ;
147
147
counter . textContent = String ( num ) ;
148
148
}
149
149
@@ -199,7 +199,7 @@ export function initRepoIssueDependencyDelete() {
199
199
200
200
export function initRepoIssueCodeCommentCancel ( ) {
201
201
// Cancel inline code comment
202
- document . addEventListener ( 'click' , ( e ) => {
202
+ document . addEventListener ( 'click' , ( e : MouseEvent & { target : HTMLElement } ) => {
203
203
if ( ! e . target . matches ( '.cancel-code-comment' ) ) return ;
204
204
205
205
const form = e . target . closest ( 'form' ) ;
@@ -268,12 +268,14 @@ export function initRepoPullRequestMergeInstruction() {
268
268
export function initRepoPullRequestAllowMaintainerEdit ( ) {
269
269
const wrapper = document . querySelector ( '#allow-edits-from-maintainers' ) ;
270
270
if ( ! wrapper ) return ;
271
- const checkbox = wrapper . querySelector ( 'input[type="checkbox"]' ) ;
271
+ const checkbox = wrapper . querySelector < HTMLInputElement > ( 'input[type="checkbox"]' ) ;
272
272
checkbox . addEventListener ( 'input' , async ( ) => {
273
273
const url = `${ wrapper . getAttribute ( 'data-url' ) } /set_allow_maintainer_edit` ;
274
274
wrapper . classList . add ( 'is-loading' ) ;
275
275
try {
276
- const resp = await POST ( url , { data : new URLSearchParams ( { allow_maintainer_edit : checkbox . checked } ) } ) ;
276
+ const resp = await POST ( url , { data : new URLSearchParams ( {
277
+ allow_maintainer_edit : String ( checkbox . checked ) ,
278
+ } ) } ) ;
277
279
if ( ! resp . ok ) {
278
280
throw new Error ( 'Failed to update maintainer edit permission' ) ;
279
281
}
@@ -322,7 +324,7 @@ export function initRepoIssueWipTitle() {
322
324
323
325
const $issueTitle = $ ( '#issue_title' ) ;
324
326
$issueTitle . trigger ( 'focus' ) ;
325
- const value = $issueTitle . val ( ) . trim ( ) . toUpperCase ( ) ;
327
+ const value = ( $issueTitle . val ( ) as string ) . trim ( ) . toUpperCase ( ) ;
326
328
327
329
const wipPrefixes = $ ( '.title_wip_desc' ) . data ( 'wip-prefixes' ) ;
328
330
for ( const prefix of wipPrefixes ) {
@@ -338,7 +340,7 @@ export function initRepoIssueWipTitle() {
338
340
export function initRepoIssueComments ( ) {
339
341
if ( ! $ ( '.repository.view.issue .timeline' ) . length ) return ;
340
342
341
- document . addEventListener ( 'click' , ( e ) => {
343
+ document . addEventListener ( 'click' , ( e : MouseEvent & { target : HTMLElement } ) => {
342
344
const urlTarget = document . querySelector ( ':target' ) ;
343
345
if ( ! urlTarget ) return ;
344
346
@@ -490,7 +492,7 @@ export function initRepoPullRequestReview() {
490
492
491
493
export function initRepoIssueReferenceIssue ( ) {
492
494
// Reference issue
493
- $ ( document ) . on ( 'click' , '.reference-issue' , function ( event ) {
495
+ $ ( document ) . on ( 'click' , '.reference-issue' , function ( e ) {
494
496
const target = this . getAttribute ( 'data-target' ) ;
495
497
const content = document . querySelector ( `#${ target } ` ) ?. textContent ?? '' ;
496
498
const poster = this . getAttribute ( 'data-poster-username' ) ;
@@ -500,7 +502,7 @@ export function initRepoIssueReferenceIssue() {
500
502
const textarea = modal . querySelector ( 'textarea[name="content"]' ) ;
501
503
textarea . value = `${ content } \n\n_Originally posted by @${ poster } in ${ reference } _` ;
502
504
$ ( modal ) . modal ( 'show' ) ;
503
- event . preventDefault ( ) ;
505
+ e . preventDefault ( ) ;
504
506
} ) ;
505
507
}
506
508
@@ -584,7 +586,7 @@ export function initRepoIssueTitleEdit() {
584
586
}
585
587
586
588
export function initRepoIssueBranchSelect ( ) {
587
- document . querySelector ( '#branch-select' ) ?. addEventListener ( 'click' , ( e ) => {
589
+ document . querySelector ( '#branch-select' ) ?. addEventListener ( 'click' , ( e : MouseEvent & { target : HTMLElement } ) => {
588
590
const el = e . target . closest ( '.item[data-branch]' ) ;
589
591
if ( ! el ) return ;
590
592
const pullTargetBranch = document . querySelector ( '#pull-target-branch' ) ;
0 commit comments