react-native-branch-deep-linking-attribution icon indicating copy to clipboard operation
react-native-branch-deep-linking-attribution copied to clipboard

Bad Typescript definition for showShareSheet

Open damienherve opened this issue 3 years ago • 0 comments

Hi everyone,

i think the showShareSheet function of the BranchUniversalObject is not well defined in index.d.ts.

Current:

interface BranchUniversalObject {
  ident: string;
  showShareSheet: (
    shareOptions?: BranchShareSheetOptions,
    linkProperties?: BranchLinkProperties,
    controlParams?: BranchLinkControlParams
  ) => void;
  generateShortUrl: (
    linkProperties: BranchLinkProperties,
    controlParams: BranchLinkControlParams
  ) => void;
  logEvent: (eventName: string, params?: BranchEventParams) => Promise<null>;
  release: () => void;
}

Should be something like (not sure about typing):

interface BranchUniversalObject {
  ident: string;
  showShareSheet: (
    shareOptions?: BranchShareSheetOptions,
    linkProperties?: BranchLinkProperties,
    controlParams?: BranchLinkControlParams
  ) => Promise<{channel: string, completed: boolean, error: string | null}>;
  generateShortUrl: (
    linkProperties: BranchLinkProperties,
    controlParams: BranchLinkControlParams
  ) => Promise<{url: string}>;
  logEvent: (eventName: string, params?: BranchEventParams) => Promise<null>;
  release: () => void;
}

generateShortUrl is probably not well defined too, but i don't use it so i don't know exactly if this is the good typing.

Can you correct this please?

damienherve avatar Apr 28 '21 13:04 damienherve