Make more of the codebase conform to strict types (#10857)
This commit is contained in:
parent
7f017a84c2
commit
6a3f59cc76
45 changed files with 127 additions and 121 deletions
|
@ -107,7 +107,7 @@ interface IProps {
|
|||
initialCaret?: DocumentOffset;
|
||||
disabled?: boolean;
|
||||
|
||||
onChange?(selection: Caret, inputType?: string, diff?: IDiff): void;
|
||||
onChange?(selection?: Caret, inputType?: string, diff?: IDiff): void;
|
||||
onPaste?(event: ClipboardEvent<HTMLDivElement>, model: EditorModel): boolean;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
private isIMEComposing = false;
|
||||
private hasTextSelected = false;
|
||||
|
||||
private _isCaretAtEnd: boolean;
|
||||
private _isCaretAtEnd = false;
|
||||
private lastCaret: DocumentOffset;
|
||||
private lastSelection: ReturnType<typeof cloneSelection> | null = null;
|
||||
|
||||
|
@ -230,7 +230,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
}
|
||||
}
|
||||
|
||||
private updateEditorState = (selection: Caret, inputType?: string, diff?: IDiff): void => {
|
||||
private updateEditorState = (selection?: Caret, inputType?: string, diff?: IDiff): void => {
|
||||
if (!this.editorRef.current) return;
|
||||
renderModel(this.editorRef.current, this.props.model);
|
||||
if (selection) {
|
||||
|
|
|
@ -39,6 +39,7 @@ import { useDispatcher } from "../../../hooks/useDispatcher";
|
|||
import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds";
|
||||
import IconizedContextMenu, { IconizedContextMenuOptionList } from "../context_menus/IconizedContextMenu";
|
||||
import { EmojiButton } from "./EmojiButton";
|
||||
import { filterBoolean } from "../../../utils/arrays";
|
||||
import { useSettingValue } from "../../../hooks/useSettings";
|
||||
import { ButtonEvent } from "../elements/AccessibleButton";
|
||||
|
||||
|
@ -118,8 +119,8 @@ const MessageComposerButtons: React.FC<IProps> = (props: IProps) => {
|
|||
];
|
||||
}
|
||||
|
||||
mainButtons = mainButtons.filter((x: ReactElement) => x);
|
||||
moreButtons = moreButtons.filter((x: ReactElement) => x);
|
||||
mainButtons = filterBoolean(mainButtons);
|
||||
moreButtons = filterBoolean(moreButtons);
|
||||
|
||||
const moreOptionsClasses = classNames({
|
||||
mx_MessageComposer_button: true,
|
||||
|
|
|
@ -313,7 +313,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
|
|||
private onResize = (
|
||||
e: MouseEvent | TouchEvent,
|
||||
travelDirection: Direction,
|
||||
refToElement: HTMLDivElement,
|
||||
refToElement: HTMLElement,
|
||||
delta: ResizeDelta,
|
||||
): void => {
|
||||
const newHeight = this.heightAtStart + delta.height;
|
||||
|
@ -329,7 +329,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
|
|||
private onResizeStop = (
|
||||
e: MouseEvent | TouchEvent,
|
||||
travelDirection: Direction,
|
||||
refToElement: HTMLDivElement,
|
||||
refToElement: HTMLElement,
|
||||
delta: ResizeDelta,
|
||||
): void => {
|
||||
const newHeight = this.heightAtStart + delta.height;
|
||||
|
|
|
@ -27,7 +27,7 @@ import SearchWarning, { WarningKind } from "../elements/SearchWarning";
|
|||
|
||||
interface IProps {
|
||||
onCancelClick: () => void;
|
||||
onSearch: (query: string, scope: string) => void;
|
||||
onSearch: (query: string, scope: SearchScope) => void;
|
||||
searchInProgress?: boolean;
|
||||
isRoomEncrypted?: boolean;
|
||||
}
|
||||
|
|
|
@ -686,7 +686,7 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
|||
return false;
|
||||
};
|
||||
|
||||
private onChange = (selection: Caret, inputType?: string, diff?: IDiff): void => {
|
||||
private onChange = (selection?: Caret, inputType?: string, diff?: IDiff): void => {
|
||||
// We call this in here rather than onKeyDown as that would trip it on global shortcuts e.g. Ctrl-k also
|
||||
if (!!diff) {
|
||||
this.prepareToEncrypt?.();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue