diff --git a/package.json b/package.json
index b570791..62a1c9e 100644
--- a/package.json
+++ b/package.json
@@ -150,7 +150,7 @@
"@types/loadable__component": "^5.13.4",
"@types/loadable__server": "^5.12.6",
"@types/loadable__webpack-plugin": "^5.7.3",
- "@types/mini-css-extract-plugin": "^2.0.1",
+ "@types/mini-css-extract-plugin": "^2.2.0",
"@types/morgan": "^1.9.3",
"@types/react-dom": "^17.0.8",
"@types/react-helmet": "^6.1.1",
@@ -192,7 +192,7 @@
"imagemin-svgo": "^9.0.0",
"jest": "^27.0.6",
"lint-staged": "^11.0.0",
- "mini-css-extract-plugin": "^2.1.0",
+ "mini-css-extract-plugin": "2.2.0",
"nodemon": "^2.0.9",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.5",
diff --git a/src/app/index.tsx b/src/app/index.tsx
index 4520708..f5a25bc 100755
--- a/src/app/index.tsx
+++ b/src/app/index.tsx
@@ -50,6 +50,7 @@ const App = ({ route, location }: Route): JSX.Element => {
{/* Child routes won't render without this */}
{renderRoutes(route.routes)}
+
)
}
diff --git a/src/components/Admin/MemberEdit.tsx b/src/components/Admin/MemberEdit.tsx
index 0a538a9..e4ff6cb 100644
--- a/src/components/Admin/MemberEdit.tsx
+++ b/src/components/Admin/MemberEdit.tsx
@@ -7,7 +7,7 @@ import { Volunteer } from "../../services/volunteers"
import styles from "./styles.module.scss"
import { toastError } from "../../store/utils"
-interface Props {
+interface Props extends JSX.IntrinsicAttributes {
volunteer: Volunteer
saveVolunteer: (newVolunteer: Partial) => void
addBefore?: () => void
diff --git a/src/components/Asks/AskDayWishes.tsx b/src/components/Asks/AskDayWishes.tsx
index b634a1b..951b256 100644
--- a/src/components/Asks/AskDayWishes.tsx
+++ b/src/components/Asks/AskDayWishes.tsx
@@ -19,9 +19,9 @@ export function AskDayWishes(asks: JSX.Element[], id: number): void {
}, [dispatch, id, jwtToken, volunteerAsks?.hiddenAsks])
const [userWishes] = useUserDayWishes()
- const participation = get(userWishes, "active", "inconnu")
- const newSelection = get(userWishes, "dayWishes", [])
- const comment = get(userWishes, "dayWishesComment", "")
+ const participation = get(userWishes, "active", "inconnu") as string
+ const newSelection = get(userWishes, "dayWishes", []) as string[]
+ const comment = get(userWishes, "dayWishesComment", "") as string
const needToShow = participation === "inconnu" || (newSelection.length === 0 && !comment)
addAsk(
diff --git a/src/components/ErrorBoundary/__tests__/ErrorBoundary.tsx b/src/components/ErrorBoundary/__tests__/ErrorBoundary.tsx
deleted file mode 100644
index a73da71..0000000
--- a/src/components/ErrorBoundary/__tests__/ErrorBoundary.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * @jest-environment jsdom
- */
-import { ReactNode } from "react"
-import { render, screen } from "@testing-library/react"
-import { MemoryRouter } from "react-router-dom"
-
-import ErrorBoundary from "../index"
-
-describe("", () => {
- const tree = (children?: ReactNode) =>
- render(
-
- {children}
-
- ).container.firstChild
-
- it("renders nothing if no children", () => {
- expect(tree()).toMatchSnapshot()
- })
-
- it("renders children if no error", () => {
- expect(
- tree(
-
-
I am PeL
-
- )
- ).toMatchSnapshot()
- })
-
- it("renders error view if an error occurs", () => {
- console.error = jest.fn()
-
- tree({new Error()}
)
-
- expect(screen.getByTestId("error-view")).toBeInTheDocument()
- })
-})
diff --git a/src/components/ErrorBoundary/__tests__/__snapshots__/ErrorBoundary.tsx.snap b/src/components/ErrorBoundary/__tests__/__snapshots__/ErrorBoundary.tsx.snap
deleted file mode 100644
index 0c9a51c..0000000
--- a/src/components/ErrorBoundary/__tests__/__snapshots__/ErrorBoundary.tsx.snap
+++ /dev/null
@@ -1,11 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders children if no error 1`] = `
-
-
- I am PeL
-
-
-`;
-
-exports[` renders nothing if no children 1`] = `null`;
diff --git a/src/components/ErrorBoundary/index.tsx b/src/components/ErrorBoundary/index.tsx
index fb9cc09..fc0b975 100755
--- a/src/components/ErrorBoundary/index.tsx
+++ b/src/components/ErrorBoundary/index.tsx
@@ -1,7 +1,7 @@
import { ReactNode, PureComponent } from "react"
interface Props {
- children?: ReactNode
+ children: ReactNode | undefined
}
interface State {
error: Error | null
diff --git a/src/components/ForgotForm/ForgotForm.tsx b/src/components/ForgotForm/ForgotForm.tsx
index eea33d4..65771bd 100644
--- a/src/components/ForgotForm/ForgotForm.tsx
+++ b/src/components/ForgotForm/ForgotForm.tsx
@@ -1,4 +1,5 @@
import React, { memo, useCallback } from "react"
+import type {} from "redux-thunk/extend-redux"
import { AppDispatch } from "../../store"
import { fetchVolunteerForgot } from "../../store/volunteerForgot"
import styles from "./styles.module.scss"
diff --git a/src/components/RegisterForm/index.tsx b/src/components/RegisterForm/index.tsx
index 1e5095d..432326b 100644
--- a/src/components/RegisterForm/index.tsx
+++ b/src/components/RegisterForm/index.tsx
@@ -1,5 +1,6 @@
import { memo, useEffect, useState } from "react"
import { useSelector, shallowEqual } from "react-redux"
+import type {} from "redux-thunk/extend-redux"
import { toast } from "react-toastify"
import _ from "lodash"
import classnames from "classnames"
diff --git a/src/components/TeamAssignment/TeamWithCandidates.tsx b/src/components/TeamAssignment/TeamWithCandidates.tsx
index d62e887..7f55f43 100644
--- a/src/components/TeamAssignment/TeamWithCandidates.tsx
+++ b/src/components/TeamAssignment/TeamWithCandidates.tsx
@@ -7,7 +7,10 @@ import { selectTeamList } from "../../store/teamList"
import styles from "./styles.module.scss"
import { useTeamAssign } from "./teamAssign.utils"
import TeamMembers from "../TeamMembers/TeamMembers"
+import { Volunteer } from "../../services/volunteers"
+type NamedWishes = { id: number; name: string }
+type VolunteerWithTeamWishesNames = Omit & { teamWishes: NamedWishes[] }
const selectTeamsWithVolunteersCandidates = createSelector(
selectVolunteerListAlphaSorted,
selectTeamList,
@@ -15,16 +18,19 @@ const selectTeamsWithVolunteersCandidates = createSelector(
teams.map(({ id, name }: any) => {
const volunteersSelection = volunteers
.filter((volunteer) => volunteer.teamWishes.includes(id))
- .map((volunteer) => ({
- ...volunteer,
- teamWishes: volunteer.teamWishes.map((wishId) => {
- const matchingTeam = teams.find((team: any) => wishId === team?.id)
- return {
- id: matchingTeam?.id,
- name: matchingTeam?.name,
- }
- }),
- }))
+ .map(
+ (volunteer) =>
+ ({
+ ...volunteer,
+ teamWishes: volunteer.teamWishes.map((wishId) => {
+ const matchingTeam = teams.find((team: any) => wishId === team?.id)
+ return {
+ id: matchingTeam?.id,
+ name: matchingTeam?.name,
+ }
+ }),
+ } as VolunteerWithTeamWishesNames)
+ )
return {
id,
name,
@@ -56,7 +62,7 @@ const DaysDisplay: FC = ({ dayWishes }): JSX.Element => (
)
type TeamWithCandidatesVolunteerProps = {
- volunteer: any
+ volunteer: VolunteerWithTeamWishesNames
teamId: number
}
@@ -68,8 +74,8 @@ const TeamWithCandidatesVolunteer: FC = ({
const [, saveTeam] = useTeamAssign()
const onTeamSelected = useCallback(
- (selectedVolunteer, selectedTeamId) => {
- saveTeam(selectedVolunteer, selectedTeamId)
+ (selectedVolunteerId: number, selectedTeamId: number) => {
+ saveTeam(selectedVolunteerId, selectedTeamId)
},
[saveTeam]
)
@@ -86,7 +92,7 @@ const TeamWithCandidatesVolunteer: FC = ({