Sharing.shareAsync always returns an empty object?

Sharing.shareAsync can return Promise<object> but the returned object seems to always be {}. What information might this object contain? How should it be handled (or is it really always just empty)?

Hello @orome :wave:
I see that this API is not described very accurately :thinking:
The actual value returned on each platform is:

  • on iOS: Promise<{}> (empty object)
  • on Android: Promise<{}>` (empty object)
  • on Web: Promise<void> (this causes discrepancies)

You can expect this returned object to never contain any property. I guess the docs says Promise<object>, because in TypeScript there’s a convention to type {} (empty object) as object :thinking:
I guess these docs need some more clarification or a change in the returned value. I think refactoring both mobile platforms to return Promsie<void> would be a reasonable step.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.