There are instances where the outcome of an asynchronous operation holds no significance, leading to method signatures in async operations specifying Observable<any>
or Promise<any>
as the return value.
Illustration
For instance, the Ionic2 NavController outlines:
/** // ...
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
abstract remove(/* ... */): Promise<any>;
Without delving into the actual implementation, it remains uncertain whether any value (e.g. null
or undefined
) is emitted, and if there is any valuable information that can be extracted from those values.
Inquiry: Observable<void>
?
The concept of Observable<void>
or Promise<void>
seems rare. It could provide clarity regarding the absence of any useful output. Are there any technical impediments preventing the use of the void
type with observables? Or is there a specific reason why this approach isn't commonly adopted to denote empty values?