Conform more of the code base to strict null checking (#10147)

* Conform more of the code base to strict null checking

* More strict fixes

* More strict work

* Fix missing optional type

* Iterate
This commit is contained in:
Michael Telatynski 2023-02-13 17:01:43 +00:00 committed by GitHub
parent fa036a5080
commit da7aa4055e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
380 changed files with 682 additions and 694 deletions

View file

@ -69,7 +69,7 @@ class Category extends React.PureComponent<IProps> {
);
};
public render(): JSX.Element {
public render(): React.ReactNode {
const { emojis, name, heightBefore, viewportHeight, scrollTop } = this.props;
if (!emojis || emojis.length === 0) {
return null;

View file

@ -30,7 +30,7 @@ interface IProps {
}
class Emoji extends React.PureComponent<IProps> {
public render(): JSX.Element {
public render(): React.ReactNode {
const { onClick, onMouseEnter, onMouseLeave, emoji, selectedEmojis } = this.props;
const isSelected = selectedEmojis && selectedEmojis.has(emoji.unicode);
return (

View file

@ -249,7 +249,7 @@ class EmojiPicker extends React.Component<IProps, IState> {
return CATEGORY_HEADER_HEIGHT + Math.ceil(count / EMOJIS_PER_ROW) * EMOJI_HEIGHT;
}
public render(): JSX.Element {
public render(): React.ReactNode {
let heightBefore = 0;
return (
<div className="mx_EmojiPicker" data-testid="mx_EmojiPicker">

View file

@ -82,7 +82,7 @@ class Header extends React.PureComponent<IProps> {
}
};
public render(): JSX.Element {
public render(): React.ReactNode {
return (
<nav
className="mx_EmojiPicker_header"

View file

@ -24,7 +24,7 @@ interface IProps {
}
class Preview extends React.PureComponent<IProps> {
public render(): JSX.Element {
public render(): React.ReactNode {
const {
unicode,
label,

View file

@ -59,7 +59,7 @@ class QuickReactions extends React.Component<IProps, IState> {
});
};
public render(): JSX.Element {
public render(): React.ReactNode {
return (
<section className="mx_EmojiPicker_footer mx_EmojiPicker_quick mx_EmojiPicker_category">
<h2 className="mx_EmojiPicker_quick_header mx_EmojiPicker_category_label">

View file

@ -130,7 +130,7 @@ class ReactionPicker extends React.Component<IProps, IState> {
return true;
};
public render(): JSX.Element {
public render(): React.ReactNode {
return (
<EmojiPicker
onChoose={this.onChoose}

View file

@ -46,7 +46,7 @@ class Search extends React.PureComponent<IProps> {
}
};
public render(): JSX.Element {
public render(): React.ReactNode {
let rightButton;
if (this.props.query) {
rightButton = (