Explicitly specify all children props (#10312)

This commit is contained in:
Michael Telatynski 2023-03-08 13:28:07 +00:00 committed by GitHub
parent ad26925bb6
commit 80fc0997a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 86 additions and 43 deletions

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, { ReactNode } from "react";
import { lexicographicCompare } from "matrix-js-sdk/src/utils";
import { Room } from "matrix-js-sdk/src/models/room";
import { throttle } from "lodash";
@ -36,6 +36,7 @@ interface IProps {
userId: string;
showApps: boolean; // Render apps
resizeNotifier: ResizeNotifier;
children?: ReactNode;
}
interface Counter {

View file

@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { createRef, forwardRef, MouseEvent, RefObject } from "react";
import React, { createRef, forwardRef, MouseEvent, ReactNode, RefObject } from "react";
import classNames from "classnames";
import { EventType, MsgType, RelationType } from "matrix-js-sdk/src/@types/event";
import { EventStatus, MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/models/event";
@ -840,7 +840,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
return false;
}
private renderContextMenu(): React.ReactFragment {
private renderContextMenu(): ReactNode {
if (!this.state.contextMenu) return null;
const tile = this.getTile();
@ -864,7 +864,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
);
}
public render(): React.ReactNode {
public render(): ReactNode {
const msgtype = this.props.mxEvent.getContent().msgtype;
const eventType = this.props.mxEvent.getType();
const {

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { ComponentProps, createRef } from "react";
import React, { ComponentProps, createRef, ReactNode } from "react";
import { decode } from "html-entities";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { IPreviewUrlResponse } from "matrix-js-sdk/src/client";
@ -32,6 +32,7 @@ interface IProps {
link: string;
preview: IPreviewUrlResponse;
mxEvent: MatrixEvent; // the Event associated with the preview
children?: ReactNode;
}
export default class LinkPreviewWidget extends React.Component<IProps> {

View file

@ -17,7 +17,7 @@ limitations under the License.
import classNames from "classnames";
import { IEventRelation } from "matrix-js-sdk/src/models/event";
import { M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import React, { createContext, MouseEventHandler, ReactElement, useContext, useRef } from "react";
import React, { createContext, MouseEventHandler, ReactElement, ReactNode, useContext, useRef } from "react";
import { Room } from "matrix-js-sdk/src/models/room";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread";
@ -173,6 +173,7 @@ export const UploadButtonContext = createContext<UploadButtonFn | null>(null);
interface IUploadButtonProps {
roomId: string;
relation?: IEventRelation | null;
children: ReactNode;
}
// We put the file input outside the UploadButton component so that it doesn't get killed when the context menu closes.

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { MouseEvent } from "react";
import React, { MouseEvent, ReactNode } from "react";
import classNames from "classnames";
import { formatCount } from "../../../../utils/FormattingUtils";
@ -29,7 +29,7 @@ interface Props {
onClick?: (ev: MouseEvent) => void;
onMouseOver?: (ev: MouseEvent) => void;
onMouseLeave?: (ev: MouseEvent) => void;
children?: React.ReactChildren | JSX.Element;
children?: ReactNode;
label?: string;
}