@@ -124,7 +124,7 @@ export function initRepoIssueFilterItemLabel() {
124124
125125export function initRepoIssueCommentDelete ( ) {
126126 // Delete comment
127- document . addEventListener ( 'click' , async ( e ) => {
127+ document . addEventListener ( 'click' , async ( e : MouseEvent & { target : HTMLElement } ) => {
128128 if ( ! e . target . matches ( '.delete-comment' ) ) return ;
129129 e . preventDefault ( ) ;
130130
@@ -143,7 +143,7 @@ export function initRepoIssueCommentDelete() {
143143 const counter = document . querySelector ( '#review-box .review-comments-counter' ) ;
144144 let num = parseInt ( counter ?. getAttribute ( 'data-pending-comment-number' ) ) - 1 || 0 ;
145145 num = Math . max ( num , 0 ) ;
146- counter . setAttribute ( 'data-pending-comment-number' , num ) ;
146+ counter . setAttribute ( 'data-pending-comment-number' , String ( num ) ) ;
147147 counter . textContent = String ( num ) ;
148148 }
149149
@@ -199,7 +199,7 @@ export function initRepoIssueDependencyDelete() {
199199
200200export function initRepoIssueCodeCommentCancel ( ) {
201201 // Cancel inline code comment
202- document . addEventListener ( 'click' , ( e ) => {
202+ document . addEventListener ( 'click' , ( e : MouseEvent & { target : HTMLElement } ) => {
203203 if ( ! e . target . matches ( '.cancel-code-comment' ) ) return ;
204204
205205 const form = e . target . closest ( 'form' ) ;
@@ -268,12 +268,14 @@ export function initRepoPullRequestMergeInstruction() {
268268export function initRepoPullRequestAllowMaintainerEdit ( ) {
269269 const wrapper = document . querySelector ( '#allow-edits-from-maintainers' ) ;
270270 if ( ! wrapper ) return ;
271- const checkbox = wrapper . querySelector ( 'input[type="checkbox"]' ) ;
271+ const checkbox = wrapper . querySelector < HTMLInputElement > ( 'input[type="checkbox"]' ) ;
272272 checkbox . addEventListener ( 'input' , async ( ) => {
273273 const url = `${ wrapper . getAttribute ( 'data-url' ) } /set_allow_maintainer_edit` ;
274274 wrapper . classList . add ( 'is-loading' ) ;
275275 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+ } ) } ) ;
277279 if ( ! resp . ok ) {
278280 throw new Error ( 'Failed to update maintainer edit permission' ) ;
279281 }
@@ -322,7 +324,7 @@ export function initRepoIssueWipTitle() {
322324
323325 const $issueTitle = $ ( '#issue_title' ) ;
324326 $issueTitle . trigger ( 'focus' ) ;
325- const value = $issueTitle . val ( ) . trim ( ) . toUpperCase ( ) ;
327+ const value = ( $issueTitle . val ( ) as string ) . trim ( ) . toUpperCase ( ) ;
326328
327329 const wipPrefixes = $ ( '.title_wip_desc' ) . data ( 'wip-prefixes' ) ;
328330 for ( const prefix of wipPrefixes ) {
@@ -338,7 +340,7 @@ export function initRepoIssueWipTitle() {
338340export function initRepoIssueComments ( ) {
339341 if ( ! $ ( '.repository.view.issue .timeline' ) . length ) return ;
340342
341- document . addEventListener ( 'click' , ( e ) => {
343+ document . addEventListener ( 'click' , ( e : MouseEvent & { target : HTMLElement } ) => {
342344 const urlTarget = document . querySelector ( ':target' ) ;
343345 if ( ! urlTarget ) return ;
344346
@@ -490,7 +492,7 @@ export function initRepoPullRequestReview() {
490492
491493export function initRepoIssueReferenceIssue ( ) {
492494 // Reference issue
493- $ ( document ) . on ( 'click' , '.reference-issue' , function ( event ) {
495+ $ ( document ) . on ( 'click' , '.reference-issue' , function ( e ) {
494496 const target = this . getAttribute ( 'data-target' ) ;
495497 const content = document . querySelector ( `#${ target } ` ) ?. textContent ?? '' ;
496498 const poster = this . getAttribute ( 'data-poster-username' ) ;
@@ -500,7 +502,7 @@ export function initRepoIssueReferenceIssue() {
500502 const textarea = modal . querySelector ( 'textarea[name="content"]' ) ;
501503 textarea . value = `${ content } \n\n_Originally posted by @${ poster } in ${ reference } _` ;
502504 $ ( modal ) . modal ( 'show' ) ;
503- event . preventDefault ( ) ;
505+ e . preventDefault ( ) ;
504506 } ) ;
505507}
506508
@@ -584,7 +586,7 @@ export function initRepoIssueTitleEdit() {
584586}
585587
586588export function initRepoIssueBranchSelect ( ) {
587- document . querySelector ( '#branch-select' ) ?. addEventListener ( 'click' , ( e ) => {
589+ document . querySelector ( '#branch-select' ) ?. addEventListener ( 'click' , ( e : MouseEvent & { target : HTMLElement } ) => {
588590 const el = e . target . closest ( '.item[data-branch]' ) ;
589591 if ( ! el ) return ;
590592 const pullTargetBranch = document . querySelector ( '#pull-target-branch' ) ;
0 commit comments