Type the electron and matrix plugin call sites instead of any. [skip build]
This commit is contained in:
@@ -181,7 +181,7 @@ const setupKeyConflictHandler = (mx: MatrixClient, session: Session): void => {
|
||||
// Since we can't directly intercept, we'll use a MutationObserver-style approach
|
||||
// by checking for repeated key upload failures
|
||||
|
||||
const checkKeyConflict = (args: any[]): boolean => {
|
||||
const checkKeyConflict = (args: unknown[]): boolean => {
|
||||
const message = args.map((a) => String(a)).join(' ');
|
||||
return keyConflictPattern.test(message);
|
||||
};
|
||||
@@ -190,7 +190,7 @@ const setupKeyConflictHandler = (mx: MatrixClient, session: Session): void => {
|
||||
const originalError = console.error;
|
||||
const originalWarn = console.warn;
|
||||
|
||||
const errorHandler = (...args: any[]) => {
|
||||
const errorHandler = (...args: unknown[]) => {
|
||||
if (checkKeyConflict(args)) {
|
||||
keyConflictCount += 1;
|
||||
console.log(
|
||||
@@ -236,7 +236,7 @@ const setupKeyConflictHandler = (mx: MatrixClient, session: Session): void => {
|
||||
};
|
||||
|
||||
console.error = errorHandler;
|
||||
console.warn = (...args: any[]) => {
|
||||
console.warn = (...args: unknown[]) => {
|
||||
if (checkKeyConflict(args)) {
|
||||
keyConflictCount += 1;
|
||||
}
|
||||
@@ -332,9 +332,9 @@ export const initClient = async (session: Session): Promise<MatrixClient> => {
|
||||
console.log('[initMatrix] Registered global MatrixClient for auth utils');
|
||||
|
||||
return mx;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
// Handle crypto store account mismatch error
|
||||
if (error && error.message && error.message.includes("account in the store doesn't match")) {
|
||||
if (error instanceof Error && error.message.includes("account in the store doesn't match")) {
|
||||
console.error('[initMatrix] ❌ Crypto store account mismatch detected!');
|
||||
console.error('[initMatrix] Error details:', error.message);
|
||||
console.error('[initMatrix] Expected account:', session.userId, session.deviceId);
|
||||
@@ -433,7 +433,7 @@ export const logoutClient = async (mx: MatrixClient) => {
|
||||
const currentUserId = getLocalStorageItem('currentSessionUserId', undefined);
|
||||
|
||||
// Remove the current session
|
||||
const remainingSessions = allSessions.filter((s: any) => s.userId !== userId);
|
||||
const remainingSessions = allSessions.filter((s: Session) => s.userId !== userId);
|
||||
setLocalStorageItem('matrixSessions', remainingSessions);
|
||||
|
||||
// If we're logging out the current session and there are other sessions, switch to the first one
|
||||
|
||||
Reference in New Issue
Block a user