In Next.js you can call server functions from the client side directly, however, the type hints may mislead you and cause error.
For example:
We cannot trust what the client submits, the name or age prop may not exist in the real world, we should validate the data first, so change that to:
Declaring data as FormData type may not be a good idea, since there is no error hints when you accidentally use data.name or data.age, so you should change its type to unknown
But in this case, we lose type hints on the client side, a better solution is to add another function declaration for the client side using overload.