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
32 changed files with 86 additions and 43 deletions

View File

@@ -16,7 +16,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 { _t } from "../../../languageHandler";
@@ -53,9 +53,10 @@ interface IProps {
primaryDisabled?: boolean;
// something to stick next to the buttons, optionally
additive?: React.ReactNode;
additive?: ReactNode;
primaryButtonClass?: string;
children?: ReactNode;
}
/**

View File

@@ -25,6 +25,10 @@ import SdkConfig from "../../../SdkConfig";
import BugReportDialog from "../dialogs/BugReportDialog";
import AccessibleButton from "./AccessibleButton";
interface Props {
children: ReactNode;
}
interface IState {
error: Error;
}
@@ -33,8 +37,8 @@ interface IState {
* This error boundary component can be used to wrap large content areas and
* catch exceptions during rendering in the component tree below them.
*/
export default class ErrorBoundary extends React.PureComponent<{}, IState> {
public constructor(props: {}) {
export default class ErrorBoundary extends React.PureComponent<Props, IState> {
public constructor(props: Props) {
super(props);
this.state = {

View File

@@ -15,7 +15,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 classNames from "classnames";
import { Alignment } from "./Tooltip";
@@ -32,6 +32,7 @@ interface ITooltipProps {
className?: string;
tooltipClassName?: string;
kind?: InfoTooltipKind;
children?: ReactNode;
}
export default class InfoTooltip extends React.PureComponent<ITooltipProps> {

View File

@@ -16,7 +16,7 @@ limitations under the License.
import classNames from "classnames";
import { EventType } from "matrix-js-sdk/src/@types/event";
import React, { useContext, useRef, useState, MouseEvent } from "react";
import React, { useContext, useRef, useState, MouseEvent, ReactNode } from "react";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import RoomContext from "../../../contexts/RoomContext";
@@ -35,6 +35,7 @@ interface IProps {
setAvatarUrl(url: string): Promise<unknown>;
isUserAvatar?: boolean;
onClick?(ev: MouseEvent<HTMLInputElement>): void;
children?: ReactNode;
}
const MiniAvatarUploader: React.FC<IProps> = ({

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { MutableRefObject } from "react";
import React, { MutableRefObject, ReactNode } from "react";
import ReactDOM from "react-dom";
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
@@ -58,6 +58,7 @@ interface IProps {
// Handle to manually notify this PersistedElement that it needs to move
moveRef?: MutableRefObject<(() => void) | undefined>;
children: ReactNode;
}
/**

View File

@@ -15,7 +15,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 { _t } from "../../../languageHandler";
@@ -35,6 +35,7 @@ interface IProps {
// A function which will be invoked when an overflow element is required.
// This will be inserted after the children.
createOverflowElement?: (overflowCount: number, totalCount: number) => React.ReactNode;
children?: ReactNode;
}
export default class TruncatedList extends React.Component<IProps> {