tsc:allowUnreachableCode, eslint:no-unreachable, assert->assertDev

This commit is contained in:
Jamie Kyle 2022-09-15 12:17:15 -07:00 committed by GitHub
parent f627a05cf8
commit eb10aafd7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 213 additions and 176 deletions

View file

@ -27,7 +27,7 @@ import { tapToViewMessagesDeletionService } from '../services/tapToViewMessagesD
import * as Bytes from '../Bytes';
import { CURRENT_SCHEMA_VERSION } from '../types/Message2';
import { createBatcher } from '../util/batcher';
import { assert, softAssert, strictAssert } from '../util/assert';
import { assertDev, softAssert, strictAssert } from '../util/assert';
import { mapObjectWithSpec } from '../util/mapObjectWithSpec';
import type { ObjectMappingSpecType } from '../util/mapObjectWithSpec';
import { cleanDataForIpc } from './cleanDataForIpc';
@ -460,7 +460,7 @@ export function _cleanMessageData(data: MessageType): MessageType {
const result = { ...data };
// Ensure that all messages have the received_at set properly
if (!data.received_at) {
assert(false, 'received_at was not set on the message');
assertDev(false, 'received_at was not set on the message');
result.received_at = window.Signal.Util.incrementMessageCounter();
}
if (data.attachments) {
@ -1052,7 +1052,7 @@ const updateConversationBatcher = createBatcher<ConversationType>({
const ids = Object.keys(byId);
const mostRecent = ids.map((id: string): ConversationType => {
const maybeLast = last(byId[id]);
assert(maybeLast !== undefined, 'Empty array in `groupBy` result');
assertDev(maybeLast !== undefined, 'Empty array in `groupBy` result');
return maybeLast;
});
@ -1068,7 +1068,7 @@ async function updateConversations(
array: Array<ConversationType>
): Promise<void> {
const { cleaned, pathsChanged } = cleanDataForIpc(array);
assert(
assertDev(
!pathsChanged.length,
`Paths were cleaned: ${JSON.stringify(pathsChanged)}`
);