Skip to content

Commit 1dacb08

Browse files
authored
Merge pull request #3770 from LUKASZ-JK/patch-1
Update onSubmit return type
2 parents 1fc4ce9 + 27be35e commit 1dacb08

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/content/9/en/part9e.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Types look like the following:
128128
interface Props {
129129
modalOpen: boolean;
130130
onClose: () => void;
131-
onSubmit: (values: PatientFormValues) => Promise<void>;
131+
onSubmit: (values: PatientFormValues) => void;
132132
error?: string;
133133
}
134134

@@ -143,13 +143,13 @@ const AddPatientModal = ({ modalOpen, onClose, onSubmit, error }: Props) => {
143143
() => void
144144
```
145145

146-
The type of *onSubmit* is a bit more interesting, it has one parameter that has the type *PatientFormValues*. The return value of the function is _Promise&#60;void&#62;_. So again the function type is written with the arrow syntax:
146+
The type of *onSubmit* is a bit more interesting, it has one parameter that has the type *PatientFormValues*. The return value of the function is _&#60;void&#62;_. So again the function type is written with the arrow syntax:
147147

148148
```js
149-
(values: PatientFormValues) => Promise<void>
149+
(values: PatientFormValues) => <void>
150150
```
151151

152-
The return value of a *async* function is a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function#return_value) with the value that the function returns. Our function does not return anything so the proper return type is just _Promise&#60;void&#62;_.
152+
The return value of a *async* function is a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function#return_value) with the value that the function returns. Our function does not return anything so the proper return type is just _&#60;void&#62;_.
153153

154154
</div>
155155

0 commit comments

Comments
 (0)