Closed eqrion closed 1 year ago
My recollection of when we discussed the alternative you suggested is that it's easier for the user of the module to apply Promise.resolve
to the export themselves than it would be for the user to "undo" always applying Promise.resolve
in the exported function should they want the more direct/unflattened behavior.
Closing as its a duplicate of another issue. wrapped exports will always return a Promise; but a future version may allow programmer to specify a different behavior.
returnPromiseOnSuspend
is specified to either:If the wrapped export itself returns a Promise, it's not possible to tell whether the wrapped export was suspended or if it returned normally. This is definitely a corner case, so I don't know whether it's a real issue or not.
An alternative would be to returned
Promise.resolve(wrappedExportResults)
in the case the wrapped export returns normally.