Replace typescript compiler with native tsgo compiler

This commit is contained in:
Jamie
2026-03-17 14:38:10 -07:00
committed by GitHub
parent 3851a3905a
commit 023ae37492
207 changed files with 1819 additions and 1270 deletions

View File

@@ -147,7 +147,7 @@ class SmallChunksTransform extends Transform {
}
override _transform(
incomingChunk: Buffer | undefined,
incomingChunk: Buffer<ArrayBuffer> | undefined,
_encoding: string,
done: (error?: Error) => void
) {
@@ -179,7 +179,7 @@ class SmallChunksTransform extends Transform {
}
}
function generateAvatar(): Uint8Array {
function generateAvatar(): Uint8Array<ArrayBuffer> {
const result = new Uint8Array(255);
for (let i = 0; i < result.length; i += 1) {
result[i] = i;
@@ -187,11 +187,11 @@ function generateAvatar(): Uint8Array {
return result;
}
function getTestBuffer(): Uint8Array {
function getTestBuffer(): Uint8Array<ArrayBuffer> {
const avatarBuffer = generateAvatar();
const prefixedContact = generatePrefixedContact(avatarBuffer);
const chunks: Array<Uint8Array> = [];
const chunks: Array<Uint8Array<ArrayBuffer>> = [];
for (let i = 0; i < 3; i += 1) {
chunks.push(...prefixedContact);
chunks.push(avatarBuffer);
@@ -201,9 +201,9 @@ function getTestBuffer(): Uint8Array {
}
function generatePrefixedContact(
avatarBuffer: Uint8Array | undefined,
avatarBuffer: Uint8Array<ArrayBuffer> | undefined,
aci: AciString | null = DEFAULT_ACI
): [Uint8Array, Uint8Array] {
): [Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>] {
const contactInfoBuffer = Proto.ContactDetails.encode({
name: 'Zero Cool',
number: '+10000000000',

View File

@@ -728,9 +728,9 @@ describe('Crypto', () => {
overrideSize,
}: {
path?: string;
data: Uint8Array;
plaintextHash?: Uint8Array;
encryptionKeys?: Uint8Array;
data: Uint8Array<ArrayBuffer>;
plaintextHash?: Uint8Array<ArrayBuffer>;
encryptionKeys?: Uint8Array<ArrayBuffer>;
modifyIncrementalMac?: boolean;
overrideSize?: number;
}): Promise<DecryptedAttachmentV2> {
@@ -986,8 +986,8 @@ describe('Crypto', () => {
outerKeys,
}: {
plaintextAbsolutePath: string;
innerKeys: Uint8Array;
outerKeys: Uint8Array;
innerKeys: Uint8Array<ArrayBuffer>;
outerKeys: Uint8Array<ArrayBuffer>;
}) {
let innerCiphertextPath;
let outerCiphertextPath;

View File

@@ -179,10 +179,12 @@ describe('backup/calling', () => {
beforeEach(async () => {
const adminRootKey = CallLinkRootKey.generate();
const adminKey = CallLinkRootKey.generateAdminPassKey();
// @ts-expect-error needs ringrtc update
const adminKeyBytes: Uint8Array<ArrayBuffer> = adminKey;
adminCallLink = {
rootKey: adminRootKey.toString(),
roomId: getRoomIdFromRootKey(adminRootKey),
adminKey: fromAdminKeyBytes(adminKey),
adminKey: fromAdminKeyBytes(adminKeyBytes),
name: "Let's Talk Rocks",
restrictions: CallLinkRestrictions.AdminApproval,
revoked: false,

View File

@@ -18,7 +18,9 @@ import {
fetchLinkPreviewMetadata,
} from '../../linkPreviews/linkPreviewFetch.preload.js';
async function readFixtureImage(filename: string): Promise<Uint8Array> {
async function readFixtureImage(
filename: string
): Promise<Uint8Array<ArrayBuffer>> {
const result = await fs.promises.readFile(
path.join(__dirname, '..', '..', '..', 'fixtures', filename)
);
@@ -60,11 +62,15 @@ describe('link preview fetching', () => {
}: {
status?: number;
headers?: { [key: string]: null | string };
body?: null | string | Uint8Array | AsyncIterable<Uint8Array>;
body?:
| null
| string
| Uint8Array<ArrayBuffer>
| AsyncIterable<Uint8Array<ArrayBuffer>>;
url?: string;
} = {}) => {
let bodyLength: null | number;
let bodyStream: null | AsyncIterable<Uint8Array>;
let bodyStream: null | AsyncIterable<Uint8Array<ArrayBuffer>>;
if (!body) {
bodyLength = 0;
bodyStream = null;

View File

@@ -955,6 +955,7 @@ describe('AttachmentDownloadManager.runDownloadAttachmentJobInner', () => {
.returns(Promise.resolve(downloadedAttachment));
cleanupAttachmentFiles = sandbox.stub();
maybeDeleteAttachmentFile = sandbox.stub();
deleteDownloadFile = sandbox.stub();
processNewAttachment = sandbox.stub().callsFake(attachment => attachment);
});

View File

@@ -25,7 +25,7 @@ import { DAY } from '../../util/durations/constants.std.js';
describe('SenderCertificateService', () => {
let fakeValidCertificate: SenderCertificate;
let fakeValidEncodedCertificate: Uint8Array;
let fakeValidEncodedCertificate: Uint8Array<ArrayBuffer>;
let fakeValidCertificateExpiry: number;
let fakeServer: any;
let fakeEvents: Pick<typeof window.Whisper.events, 'on' | 'off'>;

View File

@@ -16,7 +16,10 @@ import { DataWriter } from '../../sql/Client.preload.js';
import { signalProtocolStore } from '../../SignalProtocolStore.preload.js';
import { itemStorage } from '../../textsecure/Storage.preload.js';
const assertEqualBuffers = (a: Uint8Array, b: Uint8Array) => {
const assertEqualBuffers = (
a: Uint8Array<ArrayBuffer>,
b: Uint8Array<ArrayBuffer>
) => {
assert.isTrue(constantTimeEqual(a, b));
};

View File

@@ -15,7 +15,7 @@ import { generateAci } from '../../types/ServiceId.std.js';
import { encryptProfileData } from '../../util/encryptProfileData.preload.js';
describe('encryptProfileData', () => {
let keyBuffer: Uint8Array;
let keyBuffer: Uint8Array<ArrayBuffer>;
let conversation: ConversationType;
beforeEach(() => {