Skip to content

Commit d777726

Browse files
[PRMP-122] Add missing function return types (#784)
1 parent 3790472 commit d777726

File tree

113 files changed

+437
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+437
-512
lines changed

app/src/App.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { AwsRum, AwsRumConfig } from 'aws-rum-web';
77
import { NdrTokenData } from './types/generic/ndrTokenData';
88
import { decodeJwtToken } from './helpers/utils/jwtDecoder';
99
import PatientAccessAuditProvider from './providers/patientAccessAuditProvider/PatientAccessAuditProvider';
10+
import { JSX } from 'react';
1011

1112
const cypress =
1213
import.meta.env.VITE_MONITOR_ACCOUNT_ID === 'not provided yet' &&
@@ -58,7 +59,7 @@ if (import.meta.env.VITE_ENVIRONMENT === 'development' && !cypress) {
5859
}
5960
}
6061

61-
function App() {
62+
const App = (): JSX.Element => {
6263
return (
6364
<ConfigProvider>
6465
<SessionProvider>
@@ -70,5 +71,5 @@ function App() {
7071
</SessionProvider>
7172
</ConfigProvider>
7273
);
73-
}
74+
};
7475
export default App;

app/src/components/blocks/_arf/completeStage/CompleteStage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface Props {
77
documents: Array<UploadDocument>;
88
}
99

10-
function CompleteStage({ documents }: Props) {
10+
const CompleteStage = ({ documents }: Props): React.JSX.Element => {
1111
const navigate = useNavigate();
1212

1313
return (
@@ -18,14 +18,14 @@ function CompleteStage({ documents }: Props) {
1818
</p>
1919
<Button
2020
id="start-again-button"
21-
onClick={() => {
21+
onClick={(): void => {
2222
navigate('/');
2323
}}
2424
>
2525
Start Again
2626
</Button>
2727
</>
2828
);
29-
}
29+
};
3030

3131
export default CompleteStage;

app/src/components/blocks/_arf/documentInputForm/DocumentInputForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const DocumentInputForm = ({
2626
inputRef,
2727
formType,
2828
showHelp = false,
29-
}: Props) => {
29+
}: Props): React.JSX.Element => {
3030
const hasDuplicateFiles = documents.some((doc: UploadDocument) => {
3131
return documents.some(
3232
(compare: UploadDocument) =>
@@ -45,10 +45,10 @@ const DocumentInputForm = ({
4545
multiple={true}
4646
name={formController.field.name}
4747
error={formController.fieldState.error?.message}
48-
onChange={(e: FileInputEvent) => onDocumentInput(e, formType)}
48+
onChange={(e: FileInputEvent): void => onDocumentInput(e, formType)}
4949
onBlur={formController.field.onBlur}
5050
// @ts-ignore The NHS Component library is outdated and does not allow for any reference other than a blank MutableRefObject
51-
inputRef={(e: HTMLInputElement) => {
51+
inputRef={(e: HTMLInputElement): void => {
5252
formController.field.ref(e);
5353
inputRef.current = e;
5454
}}
@@ -111,7 +111,7 @@ const DocumentInputForm = ({
111111
type="button"
112112
aria-label={`Remove ${document.file.name} from selection`}
113113
className="link-button"
114-
onClick={() => {
114+
onClick={(): void => {
115115
onDocumentRemove(index, formType);
116116
}}
117117
>

app/src/components/blocks/_arf/documentSearchResults/DocumentSearchResults.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ type Props = {
66
searchResults: Array<SearchResult>;
77
};
88

9-
const DocumentSearchResults = (props: Props) => {
10-
const sortMethod = (a: SearchResult, b: SearchResult) =>
9+
const DocumentSearchResults = (props: Props): React.JSX.Element => {
10+
const sortMethod = (a: SearchResult, b: SearchResult): number =>
1111
new Date(a.created) < new Date(b.created) ? 1 : -1;
1212

1313
const orderedResults = [...props.searchResults].sort(sortMethod);
1414
const tableCaption = (
1515
<h2 className="document-search-table-caption">List of documents available</h2>
1616
);
17+
1718
return (
1819
<Table id="available-files-table-title" caption={tableCaption}>
1920
<Table.Head>

app/src/components/blocks/_arf/documentSearchResultsOptions/DocumentSearchResultsOptions.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface DownloadLinkAttributes {
2222
filename: string;
2323
}
2424

25-
const DocumentSearchResultsOptions = (props: Props) => {
25+
const DocumentSearchResultsOptions = (props: Props): React.JSX.Element => {
2626
const navigate = useNavigate();
2727
const baseUrl = useBaseAPIUrl();
2828
const baseHeaders = useBaseAPIHeaders();
@@ -54,7 +54,7 @@ const DocumentSearchResultsOptions = (props: Props) => {
5454
}
5555
}, [linkAttributes]);
5656

57-
const downloadAll = async () => {
57+
const downloadAll = async (): Promise<void> => {
5858
props.updateDownloadState(SUBMISSION_STATE.PENDING);
5959
try {
6060
const preSignedUrl = await getPresignedUrlForZip({
@@ -80,7 +80,7 @@ const DocumentSearchResultsOptions = (props: Props) => {
8080
}
8181
};
8282

83-
const deleteAllDocuments = () => {
83+
const deleteAllDocuments = (): void => {
8484
navigate(routeChildren.ARF_DELETE_CONFIRMATION);
8585
};
8686

app/src/components/blocks/_arf/selectStage/SelectStage.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ interface Props {
2121
startUpload: () => Promise<void>;
2222
}
2323

24-
function SelectStage({ setDocuments, documents, startUpload }: Readonly<Props>) {
24+
const SelectStage = ({
25+
setDocuments,
26+
documents,
27+
startUpload,
28+
}: Readonly<Props>): React.JSX.Element => {
2529
const arfInputRef = useRef<HTMLInputElement | null>(null);
2630

2731
const hasFileInput = documents.length > 0;
2832

2933
const { handleSubmit, control, formState, setError } = useForm();
3034
const arfController = useController(ARFFormConfig(control));
3135

32-
const submitDocuments = async () => {
36+
const submitDocuments = async (): Promise<void> => {
3337
if (!hasFileInput) {
3438
setError('arf-documents', { type: 'custom', message: 'Select a file to upload' });
3539
return;
@@ -38,7 +42,7 @@ function SelectStage({ setDocuments, documents, startUpload }: Readonly<Props>)
3842
await startUpload();
3943
};
4044

41-
const onInput = (e: FileInputEvent, docType: DOCUMENT_TYPE) => {
45+
const onInput = (e: FileInputEvent, docType: DOCUMENT_TYPE): void => {
4246
const fileArray = Array.from(e.target.files ?? new FileList());
4347
const newlyAddedDocuments: Array<UploadDocument> = fileArray.map((file) => ({
4448
id: uuidv4(),
@@ -53,7 +57,7 @@ function SelectStage({ setDocuments, documents, startUpload }: Readonly<Props>)
5357
setDocuments(updatedDocList);
5458
};
5559

56-
const onRemove = (index: number, _docType: DOCUMENT_TYPE) => {
60+
const onRemove = (index: number, _docType: DOCUMENT_TYPE): void => {
5761
const updatedDocList: UploadDocument[] = [
5862
...documents.slice(0, index),
5963
...documents.slice(index + 1),
@@ -107,6 +111,6 @@ function SelectStage({ setDocuments, documents, startUpload }: Readonly<Props>)
107111
</form>
108112
</>
109113
);
110-
}
114+
};
111115

112116
export default SelectStage;

app/src/components/blocks/_arf/uploadConfirmationFailed/uploadConfirmationFailed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import useTitle from '../../../../helpers/hooks/useTitle';
33

4-
const UploadConfirmationFailed = () => {
4+
const UploadConfirmationFailed = (): React.JSX.Element => {
55
const pageHeader = "We couldn't confirm the upload";
66
useTitle({ pageTitle: pageHeader });
77

app/src/components/blocks/_arf/uploadFailedStage/uploadFailedStage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import useTitle from '../../../../helpers/hooks/useTitle';
33

4-
const UploadFailedStage = () => {
4+
const UploadFailedStage = (): React.JSX.Element => {
55
const pageHeader = 'All files failed to upload';
66
useTitle({ pageTitle: pageHeader });
77

app/src/components/blocks/_arf/uploadSummary/UploadSummary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import PatientSummary from '../../../generic/patientSummary/PatientSummary';
1313
export interface Props {
1414
documents: Array<UploadDocument>;
1515
}
16-
const UploadSummary = ({ documents }: Props) => {
16+
const UploadSummary = ({ documents }: Props): React.JSX.Element => {
1717
const successfulUploads = documents.filter((document) => {
1818
return document.state === DOCUMENT_UPLOAD_STATE.SUCCEEDED;
1919
});

app/src/components/blocks/_arf/uploadingStage/UploadingStage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface Props {
1212
documents: Array<UploadDocument>;
1313
}
1414

15-
function UploadingStage({ documents }: Props) {
15+
const UploadingStage = ({ documents }: Props): React.JSX.Element => {
1616
const pageHeader = 'Your documents are uploading';
1717
useTitle({ pageTitle: 'Uploading documents' });
1818

@@ -63,6 +63,6 @@ function UploadingStage({ documents }: Props) {
6363
</Table>
6464
</>
6565
);
66-
}
66+
};
6767

6868
export default UploadingStage;

0 commit comments

Comments
 (0)