Skip to content

Commit 95166b5

Browse files
committed
Fix props type errors
1 parent 48b8212 commit 95166b5

File tree

10 files changed

+27
-13
lines changed

10 files changed

+27
-13
lines changed

website/src/entry/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Store } from 'redux';
22

33
import * as React from 'react';
4+
import type { FC, PropsWithChildren } from 'react';
45
import { BrowserRouter as Router } from 'react-router-dom';
56
import { Provider } from 'react-redux';
67
import { PersistGate } from 'redux-persist/integration/react';
@@ -18,7 +19,7 @@ type Props = {
1819
persistor: Persistor;
1920
};
2021

21-
const App: React.FC<Props> = ({ store, persistor }) => {
22+
const App: FC<PropsWithChildren<Props>> = ({ store, persistor }) => {
2223
const onBeforeLift = () => {
2324
const { theme, settings } = store.getState();
2425

website/src/entry/export/TimetableOnly.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default class TimetableOnly extends Component<Props, State> {
4343
semester={semester}
4444
timetable={timetable}
4545
colors={timetableColors}
46+
hiddenImportedModules={null}
4647
readOnly
4748
/>
4849
</div>

website/src/entry/main.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ subscribeOnlineEvents(store);
2626
ReactModal.setAppElement('#app');
2727

2828
const container = document.getElementById('app');
29+
if (!container) {
30+
throw new Error('#app element not found');
31+
}
2932
const root = createRoot(container);
3033
root.render(<App store={store} persistor={persistor} />);
3134

website/src/views/AppShell.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { FC, useCallback, useEffect, useState } from 'react';
1+
import { useCallback, useEffect, useState } from 'react';
2+
import type { FC, PropsWithChildren } from 'react';
23
import type { SemTimetableConfig } from 'types/timetables';
34
import type { Semester } from 'types/modules';
45
import { DARK_COLOR_SCHEME } from 'types/settings';
@@ -103,7 +104,7 @@ function useFetchModuleListAndTimetableModules(): {
103104
};
104105
}
105106

106-
const AppShell: FC = ({ children }) => {
107+
const AppShell: FC<PropsWithChildren> = ({ children }) => {
107108
const { moduleListError, refetchModuleListAndTimetableModules } =
108109
useFetchModuleListAndTimetableModules();
109110

website/src/views/components/Modal.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { FC, useCallback, useLayoutEffect, useState } from 'react';
1+
import { useCallback, useLayoutEffect, useState } from 'react';
2+
import type { FC, PropsWithChildren } from 'react';
23
import ReactModal, { Props as ModalProps } from 'react-modal';
34
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
45
import classnames from 'classnames';
@@ -13,7 +14,7 @@ type Props = ModalProps & {
1314
animate?: boolean;
1415
};
1516

16-
const Modal: FC<Props> = ({
17+
const Modal: FC<PropsWithChildren<Props>> = ({
1718
isOpen,
1819
overlayClassName,
1920
className,
@@ -27,7 +28,7 @@ const Modal: FC<Props> = ({
2728
// `contentRef`, `contentRef` needs to be stored in component state, even if
2829
// this causes additional renders.
2930
const [modalContent, setModalContent] = useState<HTMLDivElement | undefined>();
30-
const contentRefCallback = useCallback((node) => setModalContent(node), []);
31+
const contentRefCallback = useCallback((node: HTMLDivElement) => setModalContent(node), []);
3132

3233
// Disable body scrolling if modal is open, but allow modal to scroll.
3334
useLayoutEffect(() => {

website/src/views/components/Tooltip/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const TooltipGroup = React.memo<TooltipGroupProps>(({ children, ...props }) => {
3838
if (!AsyncTooltipGroup) {
3939
// cast needed because TooltipGroupProps types children as React.ReactElement which is not
4040
// compatible with the return type of React.FC, React.ReactElement
41-
return children as React.ReactElement;
41+
return children;
4242
}
4343

4444
return <AsyncTooltipGroup {...props}>{children}</AsyncTooltipGroup>;

website/src/views/components/filters/FilterContainer.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { PanelProps } from 'searchkit';
33

44
import styles from './styles.scss';
55

6-
const FilterContainer: React.FC<PanelProps> = ({ disabled, title, children }) => {
6+
const FilterContainer: React.FC<React.PropsWithChildren<PanelProps>> = ({
7+
disabled,
8+
title,
9+
children,
10+
}) => {
711
if (disabled) return null;
812

913
return (

website/src/views/components/map/LeafletControl.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FC } from 'react';
1+
import type { FC, PropsWithChildren } from 'react';
22

33
/**
44
* Classes used by Leaflet to position controls.
@@ -19,7 +19,10 @@ type MapCustomControlProps = {
1919
*
2020
* See: https://github.com/LiveBy/react-leaflet-control/issues/44#issuecomment-723469330
2121
*/
22-
const LeafletControl: FC<MapCustomControlProps> = ({ position = 'topleft', children }) => (
22+
const LeafletControl: FC<PropsWithChildren<MapCustomControlProps>> = ({
23+
position = 'topleft',
24+
children,
25+
}) => (
2326
<div className={POSITION_CLASSES[position]}>
2427
<div className="leaflet-control leaflet-bar">{children}</div>
2528
</div>

website/src/views/errors/ErrorBoundary.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jest.mock(
1818
const error = new Error('Test error');
1919

2020
// Stateless React component which throws error
21-
const ThrowsError: React.FC<unknown> = (): never => {
21+
const ThrowsError: React.FC<React.PropsWithChildren> = (): never => {
2222
throw error;
2323
};
2424

website/src/views/static/StaticPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FC } from 'react';
1+
import type { FC, PropsWithChildren } from 'react';
22
import classnames from 'classnames';
33

44
import Title from 'views/components/Title';
@@ -9,7 +9,7 @@ type Props = {
99
className?: string;
1010
};
1111

12-
const StaticPage: FC<Props> = ({ title, className, children }) => {
12+
const StaticPage: FC<PropsWithChildren<Props>> = ({ title, className, children }) => {
1313
useScrollToTop();
1414
return (
1515
<div className={classnames('page-container', className)}>

0 commit comments

Comments
 (0)