Conform more of the codebase to strict typescript (#10841)
This commit is contained in:
parent
af78a5a2f5
commit
277a3c0146
12 changed files with 89 additions and 60 deletions
|
@ -51,6 +51,8 @@ export default class VerificationRequestDialog extends React.Component<IProps, I
|
|||
const member = this.props.member || (otherUserId ? MatrixClientPeg.get().getUser(otherUserId) : null);
|
||||
const title = request?.isSelfVerification ? _t("Verify other device") : _t("Verification Request");
|
||||
|
||||
if (!member) return null;
|
||||
|
||||
return (
|
||||
<BaseDialog
|
||||
className="mx_InfoDialog"
|
||||
|
|
|
@ -152,13 +152,10 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
}
|
||||
|
||||
private getRoom(): Room {
|
||||
const roomId = this.props.editState.getEvent().getRoomId();
|
||||
const room = this.props.mxClient.getRoom(roomId);
|
||||
// Something is very wrong if we encounter this
|
||||
if (!room) {
|
||||
throw new Error(`Cannot find room for event ${roomId}`);
|
||||
if (!this.context.room) {
|
||||
throw new Error(`Cannot render without room`);
|
||||
}
|
||||
return room;
|
||||
return this.context.room;
|
||||
}
|
||||
|
||||
private onKeyDown = (event: KeyboardEvent): void => {
|
||||
|
|
|
@ -126,19 +126,23 @@ export default class NotificationBadge extends React.PureComponent<XOR<IProps, I
|
|||
tooltip = <Tooltip className="mx_NotificationBadge_tooltip" label={label} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<StatelessNotificationBadge
|
||||
label={label}
|
||||
symbol={notification.symbol}
|
||||
count={notification.count}
|
||||
color={notification.color}
|
||||
onClick={onClick}
|
||||
onMouseOver={this.onMouseOver}
|
||||
onMouseLeave={this.onMouseLeave}
|
||||
tabIndex={tabIndex}
|
||||
>
|
||||
{tooltip}
|
||||
</StatelessNotificationBadge>
|
||||
);
|
||||
const commonProps: React.ComponentProps<typeof StatelessNotificationBadge> = {
|
||||
label,
|
||||
symbol: notification.symbol,
|
||||
count: notification.count,
|
||||
color: notification.color,
|
||||
onMouseOver: this.onMouseOver,
|
||||
onMouseLeave: this.onMouseLeave,
|
||||
};
|
||||
|
||||
if (onClick) {
|
||||
return (
|
||||
<StatelessNotificationBadge {...commonProps} onClick={onClick} tabIndex={tabIndex}>
|
||||
{tooltip}
|
||||
</StatelessNotificationBadge>
|
||||
);
|
||||
}
|
||||
|
||||
return <StatelessNotificationBadge {...commonProps}>{tooltip}</StatelessNotificationBadge>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ const KeyboardUserSettingsTab: React.FC = () => {
|
|||
return (
|
||||
<SettingsTab>
|
||||
<SettingsSection heading={_t("Keyboard")}>
|
||||
{visibleCategories.map(([categoryName, category]: [CategoryName, ICategory]) => {
|
||||
{visibleCategories.map(([categoryName, category]) => {
|
||||
return (
|
||||
<KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue