Comply with noImplicitAny (#9940)

* Stash noImplicitAny work

* Stash

* Fix imports

* Iterate

* Fix tests

* Delint

* Fix tests
This commit is contained in:
Michael Telatynski 2023-02-13 11:39:16 +00:00 committed by GitHub
parent ac7f69216e
commit 61a63e47f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
359 changed files with 1621 additions and 1353 deletions

View file

@ -53,10 +53,10 @@ interface IState {
}
export default class DateSeparator extends React.Component<IProps, IState> {
private settingWatcherRef = null;
private settingWatcherRef?: string;
public constructor(props, context) {
super(props, context);
public constructor(props: IProps) {
super(props);
this.state = {
jumpToDateEnabled: SettingsStore.getValue("feature_jump_to_date"),
};
@ -116,7 +116,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
}
}
private pickDate = async (inputTimestamp): Promise<void> => {
private pickDate = async (inputTimestamp: number | string | Date): Promise<void> => {
const unixTimestamp = new Date(inputTimestamp).getTime();
const cli = MatrixClientPeg.get();
@ -175,7 +175,7 @@ export default class DateSeparator extends React.Component<IProps, IState> {
this.closeMenu();
};
private onDatePicked = (dateString): void => {
private onDatePicked = (dateString: string): void => {
this.pickDate(dateString);
this.closeMenu();
};

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { forwardRef, ReactNode, ReactChildren } from "react";
import React, { forwardRef, ReactNode, ReactChild } from "react";
import classNames from "classnames";
interface IProps {
@ -22,7 +22,7 @@ interface IProps {
title: string;
timestamp?: JSX.Element;
subtitle?: ReactNode;
children?: ReactChildren;
children?: ReactChild;
}
const EventTileBubble = forwardRef<HTMLDivElement, IProps>(

View file

@ -16,6 +16,7 @@ limitations under the License.
import React from "react";
import { logger } from "matrix-js-sdk/src/logger";
import { IContent } from "matrix-js-sdk/src/matrix";
import { Playback } from "../../../audio/Playback";
import InlineSpinner from "../elements/InlineSpinner";
@ -66,8 +67,8 @@ export default class MAudioBody extends React.PureComponent<IBodyProps, IState>
// We should have a buffer to work with now: let's set it up
// Note: we don't actually need a waveform to render an audio event, but voice messages do.
const content = this.props.mxEvent.getContent<IMediaEventContent>();
const waveform = content?.["org.matrix.msc1767.audio"]?.waveform?.map((p) => p / 1024);
const content = this.props.mxEvent.getContent<IMediaEventContent & IContent>();
const waveform = content?.["org.matrix.msc1767.audio"]?.waveform?.map((p: number) => p / 1024);
// We should have a buffer to work with now: let's set it up
const playback = PlaybackManager.instance.createPlaybackInstance(buffer, waveform);

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { createRef } from "react";
import React, { AllHTMLAttributes, createRef } from "react";
import { filesize } from "filesize";
import { logger } from "matrix-js-sdk/src/logger";
@ -30,7 +30,7 @@ import { FileDownloader } from "../../../utils/FileDownloader";
import TextWithTooltip from "../elements/TextWithTooltip";
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
export let DOWNLOAD_ICON_URL; // cached copy of the download.svg asset for the sandboxed iframe later on
export let DOWNLOAD_ICON_URL: string; // cached copy of the download.svg asset for the sandboxed iframe later on
async function cacheDownloadIcon(): Promise<void> {
if (DOWNLOAD_ICON_URL) return; // cached already
@ -155,7 +155,7 @@ export default class MFileBody extends React.Component<IProps, IState> {
});
}
public componentDidUpdate(prevProps, prevState): void {
public componentDidUpdate(prevProps: IProps, prevState: IState): void {
if (this.props.onHeightChanged && !prevState.decryptedBlob && this.state.decryptedBlob) {
this.props.onHeightChanged();
}
@ -295,7 +295,7 @@ export default class MFileBody extends React.Component<IProps, IState> {
</span>
);
} else if (contentUrl) {
const downloadProps = {
const downloadProps: AllHTMLAttributes<HTMLAnchorElement> = {
target: "_blank",
rel: "noreferrer noopener",

View file

@ -29,7 +29,7 @@ interface IProps {
}
export default class MJitsiWidgetEvent extends React.PureComponent<IProps> {
public constructor(props) {
public constructor(props: IProps) {
super(props);
}

View file

@ -122,9 +122,9 @@ export default class MKeyVerificationRequest extends React.Component<IProps> {
return null;
}
let title;
let subtitle;
let stateNode;
let title: string;
let subtitle: string;
let stateNode: JSX.Element;
if (!request.canAccept) {
let stateLabel;

View file

@ -47,7 +47,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
private videoRef = React.createRef<HTMLVideoElement>();
private sizeWatcher: string;
public constructor(props) {
public constructor(props: IBodyProps) {
super(props);
this.state = {

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React from "react";
import React, { SyntheticEvent } from "react";
import classNames from "classnames";
import { MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
import { Relations, RelationsEvent } from "matrix-js-sdk/src/models/relations";
@ -52,7 +52,7 @@ const ReactButton: React.FC<IProps> = ({ mxEvent, reactions }) => {
})}
title={_t("Add reaction")}
onClick={openMenu}
onContextMenu={(e) => {
onContextMenu={(e: SyntheticEvent): void => {
e.preventDefault();
openMenu();
}}

View file

@ -35,6 +35,7 @@ interface IProps {
export default class ReactionsRowButtonTooltip extends React.PureComponent<IProps> {
public static contextType = MatrixClientContext;
public context!: React.ContextType<typeof MatrixClientContext>;
public render(): JSX.Element {
const { content, reactionEvents, mxEvent, visible } = this.props;
@ -42,7 +43,7 @@ export default class ReactionsRowButtonTooltip extends React.PureComponent<IProp
const room = this.context.getRoom(mxEvent.getRoomId());
let tooltipLabel;
if (room) {
const senders = [];
const senders: string[] = [];
for (const reactionEvent of reactionEvents) {
const member = room.getMember(reactionEvent.getSender());
const name = member ? member.name : reactionEvent.getSender();

View file

@ -70,7 +70,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
public static contextType = RoomContext;
public context!: React.ContextType<typeof RoomContext>;
public constructor(props) {
public constructor(props: IBodyProps) {
super(props);
this.state = {

View file

@ -37,7 +37,7 @@ interface IState {
}
export default class TileErrorBoundary extends React.Component<IProps, IState> {
public constructor(props) {
public constructor(props: IProps) {
super(props);
this.state = {

View file

@ -31,7 +31,7 @@ interface IState {
}
export default class ViewSourceEvent extends React.PureComponent<IProps, IState> {
public constructor(props) {
public constructor(props: IProps) {
super(props);
this.state = {