Skip to content

Improved TypeScript supportΒ #1004

@deammer

Description

@deammer

I would like to ask for better TypeScript support for the web SDK.

I'm facing two problems that aren't solved with the @types/mparticle__web-sdk package.

1. Custom domains are not supported in the configuration

My TypeScript apps use a custom domain to prevent events from getting blocked by browsers. However, the fields on the mParticle configuration object are not allowed in TypeScript:

Image

2. Type conflicts on the user identities

I've also noticed incompatibilities between the types and the code. For example, the userIdentities object is typed so that its fields can be string | undefined, but if I pass an undefined value, the SDK complains at runtime that the field must be a string or null.

undefined email null email
Image Image

Here's a screenshot of my browser's console when I pass email: undefined to the configuration:

Image


Would you consider writing your own types so that consumers of the web SDK don't have to rely on an outdated package? TypeScript support is a must for modern apps. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions