Enable tsconfig noUncheckedIndexedAccess

This commit is contained in:
Jamie
2026-03-12 16:24:01 -07:00
committed by GitHub
parent 34b0f9cd50
commit 1d45a52da7
311 changed files with 2146 additions and 1589 deletions

View File

@@ -101,7 +101,7 @@ describe('LeftPaneArchiveHelper', () => {
const archivedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneArchiveHelper({
...defaults,
archivedConversations,
@@ -125,7 +125,7 @@ describe('LeftPaneArchiveHelper', () => {
const archivedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneArchiveHelper(searchingDefaults);
assert.strictEqual(
@@ -140,7 +140,7 @@ describe('LeftPaneArchiveHelper', () => {
const archivedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneArchiveHelper({
...defaults,
archivedConversations,
@@ -174,7 +174,7 @@ describe('LeftPaneArchiveHelper', () => {
const archivedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneArchiveHelper({
...defaults,
archivedConversations,
@@ -194,7 +194,7 @@ describe('LeftPaneArchiveHelper', () => {
const archivedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneArchiveHelper({
...defaults,
archivedConversations,
@@ -246,7 +246,7 @@ describe('LeftPaneArchiveHelper', () => {
const archivedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneArchiveHelper({
...defaults,
archivedConversations,

View File

@@ -119,7 +119,7 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
const candidateContacts = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneChooseGroupMembersHelper({
...defaults,
candidateContacts,
@@ -145,7 +145,11 @@ describe('LeftPaneChooseGroupMembersHelper', () => {
});
it("disables non-selected contact checkboxes if you've selected the maximum number of contacts", () => {
const candidateContacts = times(50, () => getDefaultConversation());
const candidateContacts = [
getDefaultConversation(),
getDefaultConversation(),
...times(48, () => getDefaultConversation()),
] as const;
const helper = new LeftPaneChooseGroupMembersHelper({
...defaults,
candidateContacts,

View File

@@ -244,7 +244,7 @@ describe('LeftPaneComposeHelper', () => {
const composeContacts = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneComposeHelper({
composeContacts,
composeGroups: [],
@@ -280,11 +280,11 @@ describe('LeftPaneComposeHelper', () => {
const composeContacts = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const composeGroups = [
getDefaultGroupListItem(),
getDefaultGroupListItem(),
];
] as const;
const helper = new LeftPaneComposeHelper({
composeContacts,
composeGroups,
@@ -329,7 +329,7 @@ describe('LeftPaneComposeHelper', () => {
const composeContacts = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneComposeHelper({
composeContacts,
composeGroups: [],
@@ -407,7 +407,7 @@ describe('LeftPaneComposeHelper', () => {
const composeContacts = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneComposeHelper({
composeContacts,
composeGroups: [],

View File

@@ -125,7 +125,7 @@ describe('LeftPaneInboxHelper', () => {
});
it('returns undefined if the selected conversation is not pinned or non-pinned', () => {
const archivedConversations = [getDefaultConversation()];
const archivedConversations = [getDefaultConversation()] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
conversations: [getDefaultConversation(), getDefaultConversation()],
@@ -142,7 +142,7 @@ describe('LeftPaneInboxHelper', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
pinnedConversations,
@@ -162,7 +162,7 @@ describe('LeftPaneInboxHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
conversations,
@@ -176,7 +176,7 @@ describe('LeftPaneInboxHelper', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
conversations: [getDefaultConversation()],
@@ -197,7 +197,7 @@ describe('LeftPaneInboxHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
conversations,
@@ -234,7 +234,7 @@ describe('LeftPaneInboxHelper', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -260,7 +260,7 @@ describe('LeftPaneInboxHelper', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -291,7 +291,7 @@ describe('LeftPaneInboxHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -313,7 +313,7 @@ describe('LeftPaneInboxHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -341,11 +341,11 @@ describe('LeftPaneInboxHelper', () => {
getDefaultConversation(),
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -389,11 +389,11 @@ describe('LeftPaneInboxHelper', () => {
getDefaultConversation(),
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -444,11 +444,11 @@ describe('LeftPaneInboxHelper', () => {
getDefaultConversation(),
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -482,7 +482,7 @@ describe('LeftPaneInboxHelper', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -509,7 +509,7 @@ describe('LeftPaneInboxHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -536,11 +536,11 @@ describe('LeftPaneInboxHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
@@ -581,8 +581,8 @@ describe('LeftPaneInboxHelper', () => {
const pinnedConversations = [
getDefaultConversation(),
getDefaultConversation(),
];
const conversations = [getDefaultConversation()];
] as const;
const conversations = [getDefaultConversation()] as const;
const helper = new LeftPaneInboxHelper({
...defaultProps,
conversations,

View File

@@ -174,18 +174,18 @@ describe('LeftPaneSearchHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
const contacts = [getDefaultConversation()];
const messages = [fakeMessage(), fakeMessage()];
] as const;
const contacts = [getDefaultConversation()] as const;
const messages = [fakeMessage(), fakeMessage()] as const;
const helper = new LeftPaneSearchHelper({
...baseSearchHelperArgs,
conversationResults: {
isLoading: false,
results: conversations,
results: [...conversations],
},
contactResults: { isLoading: false, results: contacts },
messageResults: { isLoading: false, results: messages },
contactResults: { isLoading: false, results: [...contacts] },
messageResults: { isLoading: false, results: [...messages] },
});
assert.deepEqual(
@@ -217,13 +217,13 @@ describe('LeftPaneSearchHelper', () => {
});
it('omits conversations when there are no conversation results', () => {
const contacts = [getDefaultConversation()];
const messages = [fakeMessage(), fakeMessage()];
const contacts = [getDefaultConversation()] as const;
const messages = [fakeMessage(), fakeMessage()] as const;
const helper = new LeftPaneSearchHelper({
...baseSearchHelperArgs,
contactResults: { isLoading: false, results: contacts },
messageResults: { isLoading: false, results: messages },
contactResults: { isLoading: false, results: [...contacts] },
messageResults: { isLoading: false, results: [...messages] },
});
assert.deepEqual(_testHeaderText(helper.getRow(0)), 'icu:contactsHeader');
@@ -246,16 +246,16 @@ describe('LeftPaneSearchHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
const messages = [fakeMessage(), fakeMessage()];
] as const;
const messages = [fakeMessage(), fakeMessage()] as const;
const helper = new LeftPaneSearchHelper({
...baseSearchHelperArgs,
conversationResults: {
isLoading: false,
results: conversations,
results: [...conversations],
},
messageResults: { isLoading: false, results: messages },
messageResults: { isLoading: false, results: [...messages] },
});
assert.deepEqual(
@@ -330,16 +330,19 @@ describe('LeftPaneSearchHelper', () => {
});
it('omits messages when there are no message results', () => {
const conversations = [getDefaultConversation(), getDefaultConversation()];
const contacts = [getDefaultConversation()];
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
] as const;
const contacts = [getDefaultConversation()] as const;
const helper = new LeftPaneSearchHelper({
...baseSearchHelperArgs,
conversationResults: {
isLoading: false,
results: conversations,
results: [...conversations],
},
contactResults: { isLoading: false, results: contacts },
contactResults: { isLoading: false, results: [...contacts] },
});
assert.deepEqual(
@@ -605,14 +608,14 @@ describe('LeftPaneSearchHelper', () => {
const conversations = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneSearchHelper({
...baseSearchHelperArgs,
filterByUnread: true,
conversationResults: {
isLoading: false,
results: conversations,
results: [...conversations],
},
contactResults: { isLoading: false, results: [] },
messageResults: { isLoading: false, results: [] },

View File

@@ -89,7 +89,7 @@ describe('LeftPaneSetGroupMetadataHelper', () => {
const selectedContacts = [
getDefaultConversation(),
getDefaultConversation(),
];
] as const;
const helper = new LeftPaneSetGroupMetadataHelper({
...getComposeState(),
selectedContacts,

View File

@@ -17,7 +17,7 @@ describe('getConversationInDirection', () => {
fakeConversation(true),
fakeConversation(true),
fakeConversation(),
];
] as const;
describe('searching for any conversation', () => {
const up: ToFindType = {
@@ -107,7 +107,7 @@ describe('getConversationInDirection', () => {
fakeConversation(),
fakeConversation(),
fakeConversation(),
];
] as const;
it('returns undefined if there are no conversations', () => {
assert.isUndefined(getConversationInDirection([], up, undefined));