Sendgrid-nodejs: Type definition difficulty

Created on 20 Jan 2017  路  10Comments  路  Source: sendgrid/sendgrid-nodejs

Issue Summary

When trying to follow v3/api example and passing in a request object to sendgrid.emptyRequest
the typescript checker is giving me errors for missing parameters which are not shown in the example
eg. host,header. Are they optional if yes they should be typed as optional parameters.

//api example from sendgrid docs
var request = sg.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: mail.toJSON(),
});

//code
let req = {
method : post,
path : "/v3/mail/send",
body : mail.toJSON()
}

//message from ide
Argument of type '{ method: "POST"; path: string; body: { from: any; personalizations: any[]; subject: string; cont...' is not assignable to parameter of type 'Request'.
Property 'host' is missing in type '{ method: "POST"; path: string; body: { from: any; personalizations: any[]; subject: string; cont...'.

Technical details:

  • sendgrid-nodejs Version: "sendgrid": "^4.7.1"
  • Node.js Version: 7.2
help wanted bug

Most helpful comment

+1

All 10 comments

@sheyaweidberg,

Thanks for taking the time to report this issue. We will investigate.

@SPARTAN563 thoughts?

With Best Regards,

Elmer

This is entirely correct and an oversight in my implementation of the type - well spotted and thanks for bringing it up. I'll try and get a patch put together tomorrow and let you guys know when it's done.

Regards,
Benjamin

@thinkingserious what is the ETA on this getting merged in? Anything I can do to help push this through and get a release pushed? Would love to drop my fork ASAP

@jpinkster,

The only think that can help move this PR to the top of our backlog currently is more votes/comments on the issue.

Thanks for asking!

+1

+1

+1

+1

Thanks for the votes everyone! They have been counted.

Awesome @thinkingserious!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TobiahRex picture TobiahRex  路  3Comments

zvone187 picture zvone187  路  4Comments

thinkingserious picture thinkingserious  路  4Comments

amlcodes picture amlcodes  路  4Comments

Loriot-n picture Loriot-n  路  4Comments