Skip to content

Incorrect typings for ApnsPayload #1023

@sk-

Description

@sk-

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> { }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions