* Improve typescript null checking in places * Iterate * Fix Timer.ts
This commit is contained in:
committed by
GitHub
parent
97506cbcdb
commit
9743852380
@@ -50,8 +50,8 @@ export class OwnProfileStore extends AsyncStoreWithClient<IState> {
|
||||
// round-trip after the client is ready, and we often load widgets in that time, and we'd
|
||||
// and up passing them an incorrect display name
|
||||
super(defaultDispatcher, {
|
||||
displayName: window.localStorage.getItem(KEY_DISPLAY_NAME),
|
||||
avatarUrl: window.localStorage.getItem(KEY_AVATAR_URL),
|
||||
displayName: window.localStorage.getItem(KEY_DISPLAY_NAME) || undefined,
|
||||
avatarUrl: window.localStorage.getItem(KEY_AVATAR_URL) || undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { IDestroyable } from "../utils/IDestroyable";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
|
||||
export abstract class ReadyWatchingStore extends EventEmitter implements IDestroyable {
|
||||
protected matrixClient: MatrixClient;
|
||||
protected matrixClient: MatrixClient | null = null;
|
||||
private dispatcherRef: string | null = null;
|
||||
|
||||
public constructor(protected readonly dispatcher: Dispatcher<ActionPayload>) {
|
||||
@@ -42,7 +42,7 @@ export abstract class ReadyWatchingStore extends EventEmitter implements IDestro
|
||||
}
|
||||
}
|
||||
|
||||
public get mxClient(): MatrixClient {
|
||||
public get mxClient(): MatrixClient | null {
|
||||
return this.matrixClient; // for external readonly access
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export enum UI_EVENTS {
|
||||
}
|
||||
|
||||
export default class UIStore extends EventEmitter {
|
||||
private static _instance: UIStore = null;
|
||||
private static _instance: UIStore | null = null;
|
||||
|
||||
private resizeObserver: ResizeObserver;
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class UIStore extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
public getElementDimensions(name: string): DOMRectReadOnly {
|
||||
public getElementDimensions(name: string): DOMRectReadOnly | undefined {
|
||||
return this.uiElementDimensions.get(name);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export default class UIStore extends EventEmitter {
|
||||
}
|
||||
|
||||
public stopTrackingElementDimensions(name: string): void {
|
||||
let trackedElement: Element;
|
||||
let trackedElement: Element | undefined;
|
||||
this.trackedUiElements.forEach((trackedElementName, element) => {
|
||||
if (trackedElementName === name) {
|
||||
trackedElement = element;
|
||||
|
||||
@@ -66,7 +66,7 @@ export const flattenSpaceHierarchyWithCache =
|
||||
useCache = true,
|
||||
): Set<string> => {
|
||||
if (useCache && cache.has(spaceId)) {
|
||||
return cache.get(spaceId);
|
||||
return cache.get(spaceId)!;
|
||||
}
|
||||
const result = flattenSpaceHierarchy(spaceEntityMap, spaceDescendantMap, spaceId);
|
||||
cache.set(spaceId, result);
|
||||
|
||||
Reference in New Issue
Block a user