Type the crypto, settings, and component any sites. [skip build]
This commit is contained in:
@@ -57,7 +57,7 @@ export const promiseFulfilledResult = <T>(
|
||||
if (settledResult.status === 'fulfilled') return settledResult.value;
|
||||
return undefined;
|
||||
};
|
||||
export const promiseRejectedResult = <T>(settledResult: PromiseSettledResult<T>): any => {
|
||||
export const promiseRejectedResult = <T>(settledResult: PromiseSettledResult<T>): unknown => {
|
||||
if (settledResult.status === 'rejected') return settledResult.reason;
|
||||
return undefined;
|
||||
};
|
||||
|
||||
@@ -72,7 +72,7 @@ export const getLoginTermUrl = (params: UIAParams): string | undefined => {
|
||||
if (terms.policies === null) return undefined;
|
||||
if ('privacy_policy' in terms.policies && typeof terms.policies.privacy_policy === 'object') {
|
||||
if (terms.policies.privacy_policy === null) return undefined;
|
||||
const langToPolicy = terms.policies.privacy_policy as Record<string, any>;
|
||||
const langToPolicy = terms.policies.privacy_policy as Record<string, { url?: string }>;
|
||||
const url = langToPolicy.en?.url;
|
||||
if (typeof url === 'string') return url;
|
||||
|
||||
|
||||
@@ -165,9 +165,10 @@ export const uploadContent = async (
|
||||
const mxc = data.content_uri;
|
||||
if (mxc) onSuccess(mxc);
|
||||
else onError(new MatrixError(data));
|
||||
} catch (e: any) {
|
||||
const error = typeof e?.message === 'string' ? e.message : undefined;
|
||||
const errcode = typeof e?.name === 'string' ? e.message : undefined;
|
||||
} catch (e) {
|
||||
const err = e as { message?: string; name?: string };
|
||||
const error = typeof err?.message === 'string' ? err.message : undefined;
|
||||
const errcode = typeof err?.name === 'string' ? err.message : undefined;
|
||||
onError(new MatrixError({ error, errcode }));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
AccountDataEvents,
|
||||
EventTimeline,
|
||||
EventTimelineSet,
|
||||
EventType,
|
||||
@@ -52,7 +53,7 @@ export const getStateEvents = (room: Room, eventType: StateEvent): MatrixEvent[]
|
||||
export const getAccountData = (
|
||||
mx: MatrixClient,
|
||||
eventType: AccountDataEvent,
|
||||
): MatrixEvent | undefined => mx.getAccountData(eventType as any);
|
||||
): MatrixEvent | undefined => mx.getAccountData(eventType as keyof AccountDataEvents);
|
||||
|
||||
export const getMDirects = (mDirectEvent: MatrixEvent): Set<string> => {
|
||||
const roomIds = new Set<string>();
|
||||
|
||||
Reference in New Issue
Block a user