You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-12-05 15:22:09 +03:00
Conform more of the codebase to strictNullChecks (#10666)
* Conform more of the codebase to `strictNullChecks` * Iterate * Iterate * Iterate * Iterate
This commit is contained in:
committed by
GitHub
parent
8867f1801e
commit
93b4ee654b
@@ -24,6 +24,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
|
||||
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
|
||||
import { isSupportedReceiptType } from "matrix-js-sdk/src/utils";
|
||||
import { Optional } from "matrix-events-sdk";
|
||||
|
||||
import shouldHideEvent from "../../shouldHideEvent";
|
||||
import { wantsDateSeparator } from "../../DateUtils";
|
||||
@@ -436,10 +437,8 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
||||
* node (specifically, the bottom of it) will be positioned. If omitted, it
|
||||
* defaults to 0.
|
||||
*/
|
||||
public scrollToEvent(eventId: string, pixelOffset: number, offsetBase: number): void {
|
||||
if (this.scrollPanel.current) {
|
||||
this.scrollPanel.current.scrollToToken(eventId, pixelOffset, offsetBase);
|
||||
}
|
||||
public scrollToEvent(eventId: string, pixelOffset?: number, offsetBase?: number): void {
|
||||
this.scrollPanel.current?.scrollToToken(eventId, pixelOffset, offsetBase);
|
||||
}
|
||||
|
||||
public scrollToEventIfNeeded(eventId: string): void {
|
||||
@@ -590,16 +589,16 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
||||
return { nextEventAndShouldShow, nextTile };
|
||||
}
|
||||
|
||||
private get pendingEditItem(): string | undefined {
|
||||
private get pendingEditItem(): string | null {
|
||||
if (!this.props.room) {
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return localStorage.getItem(editorRoomKey(this.props.room.roomId, this.context.timelineRenderingType));
|
||||
} catch (err) {
|
||||
logger.error(err);
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,7 +814,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public wantsDateSeparator(prevEvent: MatrixEvent | null, nextEventDate: Date): boolean {
|
||||
public wantsDateSeparator(prevEvent: MatrixEvent | null, nextEventDate: Optional<Date>): boolean {
|
||||
if (this.context.timelineRenderingType === TimelineRenderingType.ThreadsList) {
|
||||
return false;
|
||||
}
|
||||
@@ -1174,7 +1173,7 @@ class CreationGrouper extends BaseGrouper {
|
||||
const ts = createEvent.event.getTs();
|
||||
ret.push(
|
||||
<li key={ts + "~"}>
|
||||
<DateSeparator roomId={createEvent.event.getRoomId()} ts={ts} />
|
||||
<DateSeparator roomId={createEvent.event.getRoomId()!} ts={ts} />
|
||||
</li>,
|
||||
);
|
||||
}
|
||||
@@ -1326,7 +1325,7 @@ class MainGrouper extends BaseGrouper {
|
||||
const ts = this.events[0].getTs();
|
||||
ret.push(
|
||||
<li key={ts + "~"}>
|
||||
<DateSeparator roomId={this.events[0].getRoomId()} ts={ts} />
|
||||
<DateSeparator roomId={this.events[0].getRoomId()!} ts={ts} />
|
||||
</li>,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user