Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect typings for ApnsPayload #1023

Closed
sk- opened this issue Sep 10, 2020 · 2 comments · Fixed by #1097
Closed

Incorrect typings for ApnsPayload #1023

sk- opened this issue Sep 10, 2020 · 2 comments · Fixed by #1097

Comments

@sk-
Copy link
Contributor

sk- commented Sep 10, 2020

ApnsPayload is typed as:

export interface ApnsPayload {

  /**
   * The `aps` dictionary to be included in the message.
   */
  aps: Aps;
  [customData: string]: object;
}

However, that prevents from passing string values as custom data.

Note that according to Apple

Your custom keys must have values with primitive types, such as dictionary, array, string, number, or Boolean. Custom keys are available in the userInfo dictionary of the UNNotificationContent object delivered to your app.

So I think the correct types should be something like either:

[customData: string]: any;

or

[customData: string]: JSON;

interface JSON {
    [x: string]: string|number|boolean|Date|JSON|JSONArray;
}
interface JsonArray extends Array<string|number|boolean|Date|JSON|JSONArray> { }
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@hiranya911
Copy link
Contributor

We can change the type to [customData: string]: any;. Feel free to provide a PR, or I will get around to it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants