Skip to content

Commit ef7115a

Browse files
feat: upgraded typescript to v5.9 (#6068)
1 parent b0dcbff commit ef7115a

File tree

19 files changed

+161
-182
lines changed

19 files changed

+161
-182
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const commonConfig = {
9898
'@typescript-eslint/consistent-type-definitions': 'off',
9999
'@typescript-eslint/dot-notation': 'error',
100100
'@typescript-eslint/explicit-function-return-type': 'off',
101+
'@typescript-eslint/no-unnecessary-type-conversion': 'warn',
101102
'@typescript-eslint/explicit-member-accessibility': [
102103
'error',
103104
{

extension/chrome/elements/add_pubkey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ View.run(
6969
await Ui.modal.warning(`some keys could not be processed due to errors:\n${errs.map(e => `-> ${e.message}\n`).join('')}`);
7070
}
7171
$('.copy_from_email').val('');
72-
$('.pubkey').val(String(KeyUtil.armor(keys[0])));
72+
$('.pubkey').val(KeyUtil.armor(keys[0]));
7373
$('.action_ok').trigger('click');
7474
} else if (errs.length) {
7575
await Ui.modal.error(`error processing public keys:\n${errs.map(e => `-> ${e.message}\n`).join('')}`);

extension/chrome/elements/compose-modules/compose-quote-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class ComposeQuoteModule extends ViewModule<ComposeView> {
211211
}
212212
const text = this.messageToReplyOrForward.text;
213213
const from = Str.parseEmail(this.messageToReplyOrForward.headers.from || '').email;
214-
const date = new Date(String(this.messageToReplyOrForward.headers.date));
214+
const date = new Date(this.messageToReplyOrForward.headers.date);
215215
const dateStr = Str.fromDate(date).replace(' ', ' at ');
216216
const rtl = new RegExp('[' + Str.rtlChars + ']').exec(text);
217217
const dirAttr = `dir="${rtl ? 'rtl' : 'ltr'}"`;

extension/chrome/elements/compose-modules/compose-recipients-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export class ComposeRecipientsModule extends ViewModule<ComposeView> {
300300
this.view.S.now('send_btn_text').text(this.BTN_LOADING);
301301
this.view.sizeModule.setInputTextHeightManuallyIfNeeded();
302302
recipientEl.evaluating = (async () => {
303-
this.view.errModule.debug(`evaluateRecipients.evaluat.recipient.email(${String(recipientEl.email)})`);
303+
this.view.errModule.debug(`evaluateRecipients.evaluat.recipient.email(${recipientEl.email})`);
304304
this.view.errModule.debug(`evaluateRecipients.evaluating.recipient.status(${recipientEl.status})`);
305305
this.view.errModule.debug(`evaluateRecipients.evaluating: calling getUpToDatePubkeys`);
306306
const info = await this.view.storageModule.getUpToDatePubkeys(recipientEl.email);

extension/chrome/elements/pgp_block_modules/pgp-block-attachments-module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ export class PgpBlockViewAttachmentsModule {
3030
const size = filesize(attachments[i].length);
3131

3232
const htmlContent = `<b>${Xss.escape(nameVisible)}</b>&nbsp;&nbsp;&nbsp;${size}<span class="progress"><span class="percent"></span></span>`;
33-
const attachment = $(`<a href="#" index="${Number(i)}">`);
33+
const attachment = $(`<a href="#" index="${i}">`);
3434
attachment.attr('title', name);
3535
Xss.sanitizeAppend(attachment, htmlContent);
3636
if (isEncrypted) {
3737
attachment.addClass('preview-attachment');
3838
attachment.attr('data-test', 'preview-attachment');
3939
attachment.append(
40-
`<button class="download-attachment" data-test="download-attachment-${Number(i)}" index="${Number(
40+
`<button class="download-attachment" data-test="download-attachment-${i}" index="${
4141
i
42-
)}" title="DOWNLOAD"><img src="/img/svgs/download-link-green.svg"></button>`
42+
}" title="DOWNLOAD"><img src="/img/svgs/download-link-green.svg"></button>`
4343
); // xss-escaped
4444
} else {
45-
attachment.attr('data-test', `download-attachment-${Number(i)}`);
45+
attachment.attr('data-test', `download-attachment-${i}`);
4646
attachment.addClass('download-attachment');
4747
}
4848
$('#attachments').append(attachment); // xss-escaped

extension/js/common/api/email-provider/gmail/gmail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class Gmail extends EmailProviderApi implements EmailProviderInterface {
5151
method: 'GET',
5252
data: {
5353
labelIds: labelId !== 'ALL' ? labelId : undefined,
54-
includeSpamTrash: Boolean(labelId === 'SPAM' || labelId === 'TRASH'),
54+
includeSpamTrash: labelId === 'SPAM' || labelId === 'TRASH',
5555
// pageToken: page_token,
5656
// q,
5757
// maxResults

extension/js/common/api/shared/api-error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class AjaxErr extends ApiCallErr {
101101
const redactedPayload = AjaxErr.redactSensitiveData(Catch.stringify(req.data).substring(0, 1000));
102102
stack += `\n\nresponseText(0, 1000):\n${redactedRes}\n\npayload(0, 1000):\n${redactedPayload}`;
103103
}
104-
const message = `${String(xhr.statusText || '(no status text)')}: ${String(xhr.status || -1)} when ${ApiCallErr.describeApiAction(req)} -> ${
104+
const message = `${xhr.statusText || '(no status text)'}: ${xhr.status || -1} when ${ApiCallErr.describeApiAction(req)} -> ${
105105
resMsg || '(no standard err msg)'
106106
}`;
107107
return new AjaxErr(message, stack, status, CatchHelper.censoredUrl(req.url), responseText, xhr.statusText || '(no status text)', resMsg, resDetails);

extension/js/common/browser/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { BgUtils } from '../../service_worker/bgutils.js';
1010

1111
export class Browser {
1212
public static objUrlCreate = (content: Uint8Array | string) => {
13-
return URL.createObjectURL(new Blob([content], { type: 'application/octet-stream' }));
13+
return URL.createObjectURL(new Blob([content as BlobPart], { type: 'application/octet-stream' }));
1414
};
1515

1616
public static saveToDownloads = (attachment: Attachment) => {

extension/js/common/core/crypto/smime/smime-key.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export class SmimeKey {
107107
}
108108
p7.addRecipient(certificate);
109109
}
110-
p7.content = this.forge.util.createBuffer(input);
110+
p7.content = this.forge.util.createBuffer(new Uint8Array(input));
111111
p7.encrypt();
112112
let data: Uint8Array;
113113
if (armor) {
@@ -151,7 +151,7 @@ export class SmimeKey {
151151
type: this.forge.pki.oids.messageDigest
152152
}] */
153153
});
154-
p7.content = this.forge.util.createBuffer(data);
154+
p7.content = this.forge.util.createBuffer(new Uint8Array(data));
155155
p7.sign();
156156
return SmimeKey.messageToDer(p7);
157157
}
@@ -413,7 +413,7 @@ export class SmimeKey {
413413
if (!eku) {
414414
return false;
415415
}
416-
return !!(eku as { emailProtection: boolean }).emailProtection;
416+
return (eku as { emailProtection: boolean }).emailProtection;
417417
}
418418

419419
private static dateToNumber(date: Date): undefined | number {

extension/js/common/core/mime.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class Mime {
192192
const parser = new MimeParser();
193193
const leafNodes: { [key: string]: MimeParserNode } = {};
194194
parser.onbody = (node: MimeParserNode) => {
195-
const path = String(node.path.join('.'));
195+
const path = node.path.join('.');
196196
if (typeof leafNodes[path] === 'undefined') {
197197
leafNodes[path] = node;
198198
}
@@ -343,7 +343,7 @@ export class Mime {
343343
let from: string | undefined;
344344
const getHdrValAsArr = (hdr: MimeContentHeader) =>
345345
typeof hdr === 'string' ? ([hdr].map(h => Str.parseEmail(h).email).filter(e => !!e) as string[]) : hdr.map(h => h.address);
346-
const getHdrValAsStr = (hdr: MimeContentHeader) => Str.parseEmail((Array.isArray(hdr) ? hdr[0]?.address : String(hdr || '')) || '').email;
346+
const getHdrValAsStr = (hdr: MimeContentHeader) => Str.parseEmail((Array.isArray(hdr) ? hdr[0]?.address : hdr || '') || '').email;
347347
for (const hdrName of headersNames) {
348348
const header = parsedMimeMsg.headers[hdrName];
349349
if (header) {
@@ -427,13 +427,13 @@ export class Mime {
427427
if (node.headers['content-disposition']?.[0]) {
428428
const header = node.headers['content-disposition'][0];
429429
if (header.params?.filename) {
430-
return String(header.params.filename);
430+
return header.params.filename;
431431
}
432432
}
433433
if (node.headers['content-type']?.[0]) {
434434
const header = node.headers['content-type'][0];
435435
if (header.params?.name) {
436-
return String(header.params.name);
436+
return header.params.name;
437437
}
438438
}
439439
return;

0 commit comments

Comments
 (0)