Convert files to typescript
The change converts the following files to typescript:
* elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog.ts
Change-Id: I274ba656285897c89c42f299724e402758b8cfe3
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index bc7e739..f1af68d 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -49,6 +49,7 @@
CommentInfo,
ConfigInfo,
AccountDetailInfo,
+ ChangeNum,
} from '../../../types/common';
import {GrButton} from '../gr-button/gr-button';
import {GrConfirmDeleteCommentDialog} from '../gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog';
@@ -96,6 +97,10 @@
export type Comment = Draft & CommentInfo;
export type RobotComment = Draft & RobotCommentInfo;
+export function isRobotComment(c: Comment | RobotComment): c is RobotComment {
+ return (c as RobotComment).robot_id !== undefined;
+}
+
interface CommentOverlays {
confirmDelete?: GrOverlay | null;
confirmDiscard?: GrOverlay | null;
@@ -109,6 +114,12 @@
resolvedCheckbox: HTMLInputElement;
};
}
+
+export interface CommentEventDetail {
+ patchNum?: PatchSetNum;
+ comment?: Comment | RobotComment;
+}
+
@customElement('gr-comment')
export class GrComment extends KeyboardShortcutMixin(
GestureEventListeners(LegacyElementMixin(PolymerElement))
@@ -160,7 +171,7 @@
*/
@property({type: Number})
- changeNum?: number;
+ changeNum?: ChangeNum;
@property({type: Object, notify: true, observer: '_commentChanged'})
comment?: Comment | RobotComment;
@@ -506,8 +517,8 @@
);
}
- _getEventPayload(opt_mixin?: Record<string, any>) {
- return {...opt_mixin, comment: this.comment, patchNum: this.patchNum};
+ _getEventPayload(): CommentEventDetail {
+ return {comment: this.comment, patchNum: this.patchNum};
}
_fireSave() {