Conform more code to strict null checking (#10167)
* Conform more code to strict null checking * Delint * Iterate PR based on feedback
This commit is contained in:
parent
f7bea2cae5
commit
4574c665ea
103 changed files with 517 additions and 495 deletions
|
@ -437,7 +437,7 @@ export default class SettingsStore {
|
|||
level: SettingLevel,
|
||||
roomId: string | null,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
let resultingValue = calculatedValue;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class IncompatibleController extends SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
if (this.incompatibleSetting) {
|
||||
return this.forcedValue;
|
||||
|
|
|
@ -53,7 +53,7 @@ export class NotificationsEnabledController extends SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
if (!getNotifier().isPossible()) return false;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ export class OrderedMultiController extends SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
for (const controller of this.controllers) {
|
||||
const override = controller.getValueOverride(level, roomId, calculatedValue, calculatedAtLevel);
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class ReducedMotionController extends SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
if (this.prefersReducedMotion()) {
|
||||
return false;
|
||||
|
|
|
@ -41,7 +41,7 @@ export default abstract class SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string | null,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
return null; // no override
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export default class ThemeController extends SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
if (!calculatedValue) return null; // Don't override null themes
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ export default class UIFeatureController extends SettingController {
|
|||
level: SettingLevel,
|
||||
roomId: string,
|
||||
calculatedValue: any,
|
||||
calculatedAtLevel: SettingLevel,
|
||||
calculatedAtLevel: SettingLevel | null,
|
||||
): any {
|
||||
if (this.settingDisabled) {
|
||||
// per the docs: we force a disabled state when the feature isn't active
|
||||
|
|
|
@ -22,7 +22,7 @@ const SIZE_LARGE = { w: 800, h: 600 };
|
|||
const SIZE_NORMAL_LANDSCAPE = { w: 324, h: 324 }; // for w > h
|
||||
const SIZE_NORMAL_PORTRAIT = { w: Math.ceil(324 * (9 / 16)), h: 324 }; // for h > w
|
||||
|
||||
type Dimensions = { w: number; h: number };
|
||||
type Dimensions = { w?: number; h?: number };
|
||||
|
||||
export enum ImageSize {
|
||||
Normal = "normal",
|
||||
|
@ -36,7 +36,7 @@ export enum ImageSize {
|
|||
* @returns {Dimensions} The suggested maximum dimensions for the image
|
||||
*/
|
||||
export function suggestedSize(size: ImageSize, contentSize: Dimensions, maxHeight?: number): Dimensions {
|
||||
const aspectRatio = contentSize.w / contentSize.h;
|
||||
const aspectRatio = contentSize.w! / contentSize.h!;
|
||||
const portrait = aspectRatio < 1;
|
||||
|
||||
const maxSize = size === ImageSize.Large ? SIZE_LARGE : portrait ? SIZE_NORMAL_PORTRAIT : SIZE_NORMAL_LANDSCAPE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue