Replace typescript compiler with native tsgo compiler

This commit is contained in:
Jamie
2026-03-18 11:26:18 -07:00
committed by GitHub
parent 5e6af4708b
commit c90ca2b4e0
207 changed files with 1819 additions and 1270 deletions

View File

@@ -27,13 +27,13 @@ export type BackupThumbnailType = WithOptionalProperties<ThumbnailType, 'size'>;
// These fields do not get saved to the DB.
export type EphemeralAttachmentFields = {
totalDownloaded?: number;
data?: Uint8Array;
data?: Uint8Array<ArrayBuffer>;
/** Not included in protobuf, needs to be pulled from flags */
isVoiceMessage?: boolean;
/** For messages not already on disk, this will be a data url */
url?: string;
incrementalUrl?: string;
screenshotData?: Uint8Array;
screenshotData?: Uint8Array<ArrayBuffer>;
/** @deprecated Legacy field */
screenshotPath?: string;
@@ -116,7 +116,7 @@ export type AddressableAttachmentType = Readonly<{
contentType: MIMEType;
// In-memory data, for outgoing attachments that are not saved to disk.
data?: Uint8Array;
data?: Uint8Array<ArrayBuffer>;
}>;
export type AttachmentForUIType = AttachmentType & {
@@ -135,15 +135,15 @@ export type UploadedAttachmentType = Omit<
attachmentIdentifier: Readonly<{
cdnKey: string;
}>;
key: Uint8Array;
key: Uint8Array<ArrayBuffer>;
size: number;
digest: Uint8Array;
digest: Uint8Array<ArrayBuffer>;
contentType: string;
plaintextHash: string;
}>;
export type AttachmentWithHydratedData = AttachmentType & {
data: Uint8Array;
data: Uint8Array<ArrayBuffer>;
};
export enum TextAttachmentStyleType {
@@ -183,10 +183,10 @@ export type BaseAttachmentDraftType = {
// a draft and final save on disk and in conversation.draftAttachments.
export type InMemoryAttachmentDraftType =
| ({
data: Uint8Array;
data: Uint8Array<ArrayBuffer>;
clientUuid: string;
pending: false;
screenshotData?: Uint8Array;
screenshotData?: Uint8Array<ArrayBuffer>;
duration?: number;
fileName?: string;
path?: string;

View File

@@ -57,7 +57,7 @@ export type AvatarIconType = GroupAvatarIconType | PersonalAvatarIconType;
export type AvatarDataType = {
id: number | string;
buffer?: Uint8Array;
buffer?: Uint8Array<ArrayBuffer>;
color?: AvatarColorType;
icon?: AvatarIconType;
text?: string;
@@ -86,8 +86,8 @@ export type SaveAvatarToDiskActionType = (
) => unknown;
export type AvatarUpdateType = Readonly<{
oldAvatar: Uint8Array | undefined;
newAvatar: Uint8Array | undefined;
oldAvatar: Uint8Array<ArrayBuffer> | undefined;
newAvatar: Uint8Array<ArrayBuffer> | undefined;
}>;
export type AvatarUpdateOptionsType = Readonly<

View File

@@ -14,8 +14,8 @@ export enum CallLinkUpdateSyncType {
}
export type CallLinkUpdateData = Readonly<{
rootKey: Uint8Array;
adminKey: Uint8Array | undefined;
rootKey: Uint8Array<ArrayBuffer>;
adminKey: Uint8Array<ArrayBuffer> | undefined;
}>;
/**
@@ -100,11 +100,11 @@ export type DefunctCallLinkType = Readonly<{
export type DefunctCallLinkRecord = Readonly<{
roomId: string;
rootKey: Uint8Array;
adminKey: Uint8Array | null;
rootKey: Uint8Array<ArrayBuffer>;
adminKey: Uint8Array<ArrayBuffer> | null;
storageID: string | null;
storageVersion: number | null;
storageUnknownFields: Uint8Array | null;
storageUnknownFields: Uint8Array<ArrayBuffer> | null;
storageNeedsSync: 1 | 0;
}>;
@@ -121,8 +121,8 @@ export const defunctCallLinkRecordSchema = z.object({
// DB Record
export type CallLinkRecord = Readonly<{
roomId: string;
rootKey: Uint8Array | null;
adminKey: Uint8Array | null;
rootKey: Uint8Array<ArrayBuffer> | null;
adminKey: Uint8Array<ArrayBuffer> | null;
name: string;
restrictions: number;
expiration: number | null;
@@ -131,7 +131,7 @@ export type CallLinkRecord = Readonly<{
deletedAt?: number | null;
storageID: string | null;
storageVersion: number | null;
storageUnknownFields: Uint8Array | null;
storageUnknownFields: Uint8Array<ArrayBuffer> | null;
storageNeedsSync: 1 | 0;
}>;

View File

@@ -40,7 +40,7 @@ export namespace CallQualitySurvey {
rttMedian: number | null;
jitterMedian: number | null;
packetLossFraction: number | null;
callTelemetry: Uint8Array | null;
callTelemetry: Uint8Array<ArrayBuffer> | null;
}>;
export type Form = Readonly<{

View File

@@ -46,7 +46,7 @@ export type ChatFolder = Simplify<
deletedAtTimestampMs: number;
storageID: string | null;
storageVersion: number | null;
storageUnknownFields: Uint8Array | null;
storageUnknownFields: Uint8Array<ArrayBuffer> | null;
storageNeedsSync: boolean;
}
>

View File

@@ -15,7 +15,7 @@ export type GroupSendCombinedEndorsementRecord = Readonly<{
groupId: string;
/** Unix timestamp in seconds */
expiration: number;
endorsement: Uint8Array;
endorsement: Uint8Array<ArrayBuffer>;
}>;
/**
@@ -33,7 +33,7 @@ export type GroupSendMemberEndorsementRecord = Readonly<{
memberAci: AciString;
/** Unix timestamp in seconds */
expiration: number;
endorsement: Uint8Array;
endorsement: Uint8Array<ArrayBuffer>;
}>;
/**
@@ -94,6 +94,8 @@ export const groupSendTokenSchema = z
export type GroupSendToken = z.infer<typeof groupSendTokenSchema>;
export function toGroupSendToken(token: Uint8Array): GroupSendToken {
export function toGroupSendToken(
token: Uint8Array<ArrayBuffer>
): GroupSendToken {
return parseStrict(groupSendTokenSchema, token);
}

View File

@@ -92,7 +92,7 @@ export type ContextType = {
logger: LoggerType;
}) => Promise<Blob>;
makeObjectUrl: (
data: Uint8Array | ArrayBuffer,
data: Uint8Array<ArrayBuffer> | ArrayBuffer,
contentType: MIME.MIMEType
) => string;
makeVideoScreenshot: (params: {
@@ -104,9 +104,13 @@ export type ContextType = {
revokeObjectUrl: (objectUrl: string) => void;
readAttachmentData: (
attachment: Partial<AddressableAttachmentType>
) => Promise<Uint8Array>;
writeNewAttachmentData: (data: Uint8Array) => Promise<LocalAttachmentV2Type>;
writeNewStickerData: (data: Uint8Array) => Promise<LocalAttachmentV2Type>;
) => Promise<Uint8Array<ArrayBuffer>>;
writeNewAttachmentData: (
data: Uint8Array<ArrayBuffer>
) => Promise<LocalAttachmentV2Type>;
writeNewStickerData: (
data: Uint8Array<ArrayBuffer>
) => Promise<LocalAttachmentV2Type>;
maybeDeleteAttachmentFile: (path: string) => Promise<{ wasDeleted: boolean }>;
getExistingAttachmentDataForReuse: typeof getExistingAttachmentDataForReuse;
};
@@ -845,7 +849,7 @@ export const processNewAttachment = async (
};
export const processNewSticker = async (
stickerData: Uint8Array,
stickerData: Uint8Array<ArrayBuffer>,
isEphemeral: boolean,
{
writeNewStickerData,

View File

@@ -444,7 +444,10 @@ function getReduxStickerActions() {
return actions.stickers;
}
function decryptSticker(packKey: string, ciphertext: Uint8Array): Uint8Array {
function decryptSticker(
packKey: string,
ciphertext: Uint8Array<ArrayBuffer>
): Uint8Array<ArrayBuffer> {
const binaryKey = Bytes.fromBase64(packKey);
const derivedKey = deriveStickerPackKey(binaryKey);

26
ts/types/Storage.d.ts vendored
View File

@@ -37,7 +37,7 @@ export type AutoDownloadAttachmentType = {
export type SerializedCertificateType = {
expires: number;
serialized: Uint8Array;
serialized: Uint8Array<ArrayBuffer>;
};
export type ZoomFactorType = 0.75 | 1 | 1.25 | 1.5 | 2 | number;
@@ -49,8 +49,8 @@ export type NotificationSettingType = 'message' | 'name' | 'count' | 'off';
export type IdentityKeyMap = Record<
ServiceIdString,
{
privKey: Uint8Array;
pubKey: Uint8Array;
privKey: Uint8Array<ArrayBuffer>;
pubKey: Uint8Array<ArrayBuffer>;
}
>;
@@ -111,7 +111,7 @@ export type StorageAccessType = {
maxKyberPreKeyIdPNI: number;
number_id: string;
password: string;
profileKey: Uint8Array;
profileKey: Uint8Array<ArrayBuffer>;
regionCode: string;
registrationIdMap: Record<ServiceIdString, number>;
remoteBuildExpiration: number;
@@ -147,7 +147,7 @@ export type StorageAccessType = {
storageFetchComplete: boolean;
avatarUrl: string | undefined;
manifestVersion: number;
manifestRecordIkm: Uint8Array;
manifestRecordIkm: Uint8Array<ArrayBuffer>;
storageCredentials: StorageServiceCredentials;
'storage-service-error-records': ReadonlyArray<UnknownRecord>;
'storage-service-unknown-records': ReadonlyArray<UnknownRecord>;
@@ -163,7 +163,7 @@ export type StorageAccessType = {
callLinkAuthCredentials: ReadonlyArray<GroupCredentialType>;
backupCombinedCredentials: ReadonlyArray<BackupCredentialWrapperType>;
backupCombinedCredentialsLastRequestTime: number;
backupMediaRootKey: Uint8Array;
backupMediaRootKey: Uint8Array<ArrayBuffer>;
backupMediaDownloadTotalBytes: number;
backupMediaDownloadCompletedBytes: number;
backupMediaDownloadPaused: boolean;
@@ -188,11 +188,11 @@ export type StorageAccessType = {
nextScheduledUpdateKeyTime: number;
navTabsCollapsed: boolean;
areWeASubscriber: boolean;
subscriberId: Uint8Array;
subscriberId: Uint8Array<ArrayBuffer>;
subscriberCurrencyCode: string;
// Note: for historical reasons, this has two l's
donorSubscriptionManuallyCancelled: boolean;
backupsSubscriberId: Uint8Array;
backupsSubscriberId: Uint8Array<ArrayBuffer>;
backupsSubscriberPurchaseToken: string;
backupsSubscriberOriginalTransactionId: string;
displayBadgesOnProfile: boolean;
@@ -202,8 +202,8 @@ export type StorageAccessType = {
usernameLinkCorrupted: boolean;
usernameLinkColor: number;
usernameLink: {
entropy: Uint8Array;
serverId: Uint8Array;
entropy: Uint8Array<ArrayBuffer>;
serverId: Uint8Array<ArrayBuffer>;
};
serverAlerts: ServerAlertsType;
needOrphanedAttachmentCheck: boolean;
@@ -230,7 +230,7 @@ export type StorageAccessType = {
// If present together with backupDownloadPath - we are downloading
// link-and-sync backup
backupEphemeralKey: Uint8Array;
backupEphemeralKey: Uint8Array<ArrayBuffer>;
// If present - we are resuming the download of known transfer archive
backupTransitArchive: {
@@ -274,7 +274,7 @@ export type StorageAccessType = {
avatarsHaveBeenMigrated: boolean;
// Key Transparency
lastDistinguishedTreeHead: Uint8Array;
lastDistinguishedTreeHead: Uint8Array<ArrayBuffer>;
// Meaning of values:
//
// - undefined - status unknown or uninitialized
@@ -286,7 +286,7 @@ export type StorageAccessType = {
// Test-only
// Not used UI, stored as is when imported from backup during tests
defaultWallpaperPhotoPointer: Uint8Array;
defaultWallpaperPhotoPointer: Uint8Array<ArrayBuffer>;
defaultWallpaperPreset: number;
defaultDimWallpaperInDarkMode: boolean;
defaultAutoBubbleColor: boolean;

View File

@@ -4,7 +4,7 @@
export type UsernameReservationType = Readonly<{
username: string;
previousUsername: string | undefined;
hash: Uint8Array;
hash: Uint8Array<ArrayBuffer>;
}>;
export enum ReserveUsernameError {

View File

@@ -92,9 +92,10 @@ export type AssertProps<Result, Value> = InternalAssertProps<Result, Value>;
export type UnwrapPromise<Value> = Value extends Promise<infer T> ? T : Value;
export type BytesToStrings<Value> = Value extends Uint8Array
? string
: { [Key in keyof Value]: BytesToStrings<Value[Key]> };
export type BytesToStrings<Value> =
Value extends Uint8Array<ArrayBuffer>
? string
: { [Key in keyof Value]: BytesToStrings<Value[Key]> };
export type JSONWithUnknownFields<Value> =
Value extends Record<string | symbol | number, unknown>

View File

@@ -120,7 +120,7 @@ const MINIMUM_JPEG_QUALITY = 0.1;
const ADDITIONAL_QUALITY_DECREASE_PER_ITERATION = 0.1;
export type CreatedThumbnailType = {
data: Uint8Array;
data: Uint8Array<ArrayBuffer>;
height: number;
width: number;
mimeType: MIMEType;
@@ -285,7 +285,7 @@ export async function makeVideoScreenshot({
}
export function makeObjectUrl(
data: Uint8Array | ArrayBuffer,
data: Uint8Array<ArrayBuffer> | ArrayBuffer,
contentType: MIMEType
): string {
const blob = new Blob([data], {

View File

@@ -67,6 +67,6 @@ export type BackupsSubscriptionType = (
export type LocalBackupMetadataVerificationType = {
snapshotDir: string;
backupId: Uint8Array;
metadataKey: Uint8Array;
backupId: Uint8Array<ArrayBuffer>;
metadataKey: Uint8Array<ArrayBuffer>;
};

View File

@@ -3,5 +3,5 @@
export type SafetyNumberType = Readonly<{
numberBlocks: ReadonlyArray<string>;
qrData: Uint8Array;
qrData: Uint8Array<ArrayBuffer>;
}>;