forcedotcom / SalesforceMobileSDK-iOS

iOS SDK for Salesforce
Other
538 stars 421 forks source link

TypeScript definition file is incorrect #3140

Closed yvbeek closed 4 years ago

yvbeek commented 4 years ago

1. Version of React-Native SFMC SDK used: 6.4.0

The TypeScript definition file included with the React-Native SFMC SDK is incorrect.

The MCReactModule is exported as a normal export.

export class MCReactModule {
  static isPushEnabled(): Promise<boolean>;
  ...

But it should be a default export.

export default class MCReactModule {
  static isPushEnabled(): Promise<boolean>;
  ...
}

My temporary workaround is to add a sfmc.d.ts file to my project with:

declare module "react-native-marketingcloudsdk" {
  export default class MCReactModule {
    static isPushEnabled(): Promise<boolean>;
    static enablePush(): void;
    static disablePush(): void;
    static getSystemToken(): Promise<string>;
    static getAttributes(): Promise<Map<string, string>>;
    static setAttribute(key: string, value: string): void;
    static clearAttribute(key: string): void;
    static addTag(tag: string): void;
    static removeTag(tag: string): void;
    static getTags(): Promise<Array<string>>;
    static setContactKey(contactKey: string): void;
    static getContactKey(): Promise<string>;
    static enableVerboseLogging(): void;
    static disableVerboseLogging(): void;
    static logSdkState(): void;
  }
}
brandonpage commented 4 years ago

Hi @yvbeek. This repo is for the Salesforce Mobile SDK, not the Marketing Cloud Push SDK. Please use Stack Exchange for support for that product.

yvbeek commented 4 years ago

Ok sorry, SalesForce support told me to report the issues there. I'll ask around on Stack Exchange.

brandonpage commented 4 years ago

No problem. The Marketing Cloud SDK team seems really good about answering questions there.