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

Typescript Notify V1 notification - data parameter doesn't match docs #408

Closed
mhaywardSchlow opened this issue Jan 16, 2019 · 2 comments · Fixed by #475
Closed

Typescript Notify V1 notification - data parameter doesn't match docs #408

mhaywardSchlow opened this issue Jan 16, 2019 · 2 comments · Fixed by #475
Labels
code-generation issue deals with generated code difficulty: easy fix is easy in difficulty type: bug bug in the library type: twilio enhancement feature request on Twilio's roadmap

Comments

@mhaywardSchlow
Copy link

Version: 3.27.1

Hello,

Thanks for the awesome library -- I'm running into one small issue.

The data property for the notification service is listed in the documentation as an object however the Typescript bindings are giving me a type-mismatch error saying it needs to be a string.

Looking at the code, it looks like it's referenced as a string property here, but in other sdks like twilio-python, it is listed as a dict or in the twilio-csharp it is listed as an object.

Code Snippet

The below snippet gives me an error

service.notifications.create({
                    identity,
                    data: {
                        title, 
                        notId, 
                        body,
                    }
                });

Error:

Argument of type '{ identity: any; data: { title: any; notId: number; body: any; }; }' is not assignable to parameter of type 'NotificationListInstanceCreateOptions'.
  Types of property 'data' are incompatible.
    Type '{ title: any; notId: number; body: any; }' is not assignable to type 'string'.

Should the typescript bindings be modified to match the types of the other SDKs or am I doing something wrong?

Thanks for your help!

@packlam
Copy link

packlam commented Jul 8, 2019

Version: 3.33.0

This is also the case for many of the other properties on the NotificationListInstanceCreateOptions interface. The following properties are all typed as strings when the documentation states that they're objects:

  • alexa
  • apn
  • data
  • facebookMessenger
  • fcm
  • gcm
  • sms

@childish-sambino childish-sambino added code-generation issue deals with generated code difficulty: easy fix is easy in difficulty type: bug bug in the library type: twilio enhancement feature request on Twilio's roadmap labels Aug 27, 2019
@childish-sambino
Copy link
Contributor

Yup, should be an object instead. Working on a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-generation issue deals with generated code difficulty: easy fix is easy in difficulty type: bug bug in the library type: twilio enhancement feature request on Twilio's roadmap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants