Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 80fc099

Browse files
authored
Explicitly specify all children props (#10312)
1 parent ad26925 commit 80fc099

32 files changed

+86
-43
lines changed

src/AsyncWrapper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React, { ComponentType } from "react";
17+
import React, { ComponentType, PropsWithChildren } from "react";
1818
import { logger } from "matrix-js-sdk/src/logger";
1919

2020
import { _t } from "./languageHandler";
@@ -31,7 +31,7 @@ interface IProps {
3131
}
3232

3333
interface IState {
34-
component?: ComponentType;
34+
component?: ComponentType<PropsWithChildren<any>>;
3535
error?: Error;
3636
}
3737

src/components/structures/AutoHideScrollbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
*/
1717

1818
import classNames from "classnames";
19-
import React, { HTMLAttributes, ReactHTML, WheelEvent } from "react";
19+
import React, { HTMLAttributes, ReactHTML, ReactNode, WheelEvent } from "react";
2020

2121
type DynamicHtmlElementProps<T extends keyof JSX.IntrinsicElements> =
2222
JSX.IntrinsicElements[T] extends HTMLAttributes<{}> ? DynamicElementProps<T> : DynamicElementProps<"div">;
@@ -30,6 +30,7 @@ export type IProps<T extends keyof JSX.IntrinsicElements> = Omit<DynamicHtmlElem
3030
style?: React.CSSProperties;
3131
tabIndex?: number;
3232
wrappedRef?: (ref: HTMLDivElement) => void;
33+
children: ReactNode;
3334
};
3435

3536
export default class AutoHideScrollbar<T extends keyof JSX.IntrinsicElements> extends React.Component<IProps<T>> {

src/components/structures/ContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ interface IState {
111111
// Generic ContextMenu Portal wrapper
112112
// all options inside the menu should be of role=menuitem/menuitemcheckbox/menuitemradiobutton and have tabIndex={-1}
113113
// this will allow the ContextMenu to manage its own focus using arrow keys as per the ARIA guidelines.
114-
export default class ContextMenu extends React.PureComponent<IProps, IState> {
114+
export default class ContextMenu extends React.PureComponent<React.PropsWithChildren<IProps>, IState> {
115115
private readonly initialFocus: HTMLElement;
116116

117117
public static defaultProps = {

src/components/structures/MainSplit.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
import React from "react";
18+
import React, { ReactNode } from "react";
1919
import { NumberSize, Resizable } from "re-resizable";
2020
import { Direction } from "re-resizable/lib/resizer";
2121

@@ -25,6 +25,7 @@ interface IProps {
2525
resizeNotifier: ResizeNotifier;
2626
collapsedRhs?: boolean;
2727
panel?: JSX.Element;
28+
children: ReactNode;
2829
}
2930

3031
export default class MainSplit extends React.Component<IProps> {

src/components/structures/ScrollPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ interface IProps {
7474
* of the wrapper
7575
*/
7676
fixedChildren?: ReactNode;
77+
children?: ReactNode;
7778

7879
/* onFillRequest(backwards): a callback which is called on scroll when
7980
* the user nears the start (backwards = true) or end (backwards =

src/components/structures/SpaceHierarchy.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ interface ITileProps {
8181
selected?: boolean;
8282
numChildRooms?: number;
8383
hasPermissions?: boolean;
84+
children?: ReactNode;
8485
onViewRoomClick(): void;
8586
onJoinRoomClick(): Promise<unknown>;
8687
onToggleClick?(): void;

src/components/structures/UserMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React, { createRef } from "react";
17+
import React, { createRef, ReactNode } from "react";
1818
import { Room } from "matrix-js-sdk/src/models/room";
1919

2020
import { MatrixClientPeg } from "../../MatrixClientPeg";
@@ -54,6 +54,7 @@ import { SDKContext } from "../../contexts/SDKContext";
5454

5555
interface IProps {
5656
isPanelCollapsed: boolean;
57+
children?: ReactNode;
5758
}
5859

5960
type PartialDOMRect = Pick<DOMRect, "width" | "left" | "top" | "height">;

src/components/views/auth/AuthPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ See the License for the specific language governing permissions and
1616
limitations under the License.
1717
*/
1818

19-
import React from "react";
19+
import React, { ReactNode } from "react";
2020

2121
import AuthFooter from "./AuthFooter";
2222

23-
export default class AuthPage extends React.PureComponent {
23+
export default class AuthPage extends React.PureComponent<{ children: ReactNode }> {
2424
public render(): React.ReactNode {
2525
return (
2626
<div className="mx_AuthPage">

src/components/views/auth/CompleteSecurityBody.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React from "react";
17+
import React, { ReactNode } from "react";
1818

19-
export default class CompleteSecurityBody extends React.PureComponent {
19+
export default class CompleteSecurityBody extends React.PureComponent<{ children: ReactNode }> {
2020
public render(): React.ReactNode {
2121
return <div className="mx_CompleteSecurityBody">{this.props.children}</div>;
2222
}

src/components/views/avatars/MemberAvatar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
import React, { useContext } from "react";
18+
import React, { ReactNode, useContext } from "react";
1919
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
2020
import { ResizeMethod } from "matrix-js-sdk/src/@types/partials";
2121

@@ -42,6 +42,7 @@ interface IProps extends Omit<React.ComponentProps<typeof BaseAvatar>, "name" |
4242
style?: any;
4343
forceHistorical?: boolean; // true to deny `useOnlyCurrentProfiles` usage. Default false.
4444
hideTitle?: boolean;
45+
children?: ReactNode;
4546
}
4647

4748
export default function MemberAvatar({

0 commit comments

Comments
 (0)