You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, there are cases where it is not possible to call the function in order to get an object for cloning the return type.
Use Case
The use case I have found is when defining a utility function that uses another function's return type as a parameter.
For example, it is common in complex processes to break the main process into multiple functions that return an intermediate result of the process which is then passed to the next function to continue processing:
Of course these functions could be defined inline in the mainProcess, but for testing and code organization it may be ideal to export them at the base level.
It is also possible to manually define a type or interface for each, but in many cases, the return type value is it's own best definition.
The text was updated successfully, but these errors were encountered:
I think it would be useful to be able to name a complex return type:
Code
Wordaround
It is possible to get the return type, by actually calling the method and then using that object to define the type:
However, there are cases where it is not possible to call the function in order to get an object for cloning the return type.
Use Case
The use case I have found is when defining a utility function that uses another function's return type as a parameter.
For example, it is common in complex processes to break the main process into multiple functions that return an intermediate result of the process which is then passed to the next function to continue processing:
Of course these functions could be defined inline in the mainProcess, but for testing and code organization it may be ideal to export them at the base level.
It is also possible to manually define a type or interface for each, but in many cases, the return type value is it's own best definition.
The text was updated successfully, but these errors were encountered: